aboutsummaryrefslogtreecommitdiff
path: root/js/ninja.reel/ninja.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-xjs/ninja.reel/ninja.js47
1 files changed, 11 insertions, 36 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 42d15d8b..24e47612 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -379,7 +379,6 @@ exports.Ninja = Montage.create(Component, {
379 this.eventManager.addEventListener("selectSubTool", this, false); 379 this.eventManager.addEventListener("selectSubTool", this, false);
380 this.eventManager.addEventListener("executePreview", this, false); 380 this.eventManager.addEventListener("executePreview", this, false);
381 381
382 this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false);
383 this.addPropertyChangeListener("appModel.debug", this.toggleDebug, false); 382 this.addPropertyChangeListener("appModel.debug", this.toggleDebug, false);
384 } 383 }
385 }, 384 },
@@ -535,42 +534,18 @@ exports.Ninja = Montage.create(Component, {
535 } 534 }
536 }, 535 },
537 536
538 executeLivePreview: { 537 // Turn on WebGL animation on/off
539 value: function() { 538 toggleWebGlAnimation: {
540 var transitionStopRule; 539 value: function(animate) {
541// this.stage.hideCanvas(this.appModel.livePreview); 540 Array.prototype.slice.call(elt.querySelectorAll('[data-RDGE-id]'),0).forEach(function(glCanvas) {
542 541 if(animate) {
543 if(this.appModel.livePreview) { 542 glCanvas.elementModel.shapeModel.GLWorld._previewAnimation = true;
544 transitionStopRule = "nj-css-garbage-selector"; 543 glCanvas.elementModel.shapeModel.GLWorld.restartRenderLoop();
545 this.stage.bindingView.hide = true; 544 } else if (!glCanvas.elementModel.shapeModel.animate ) {
546 } else { 545 glCanvas.elementModel.shapeModel.GLWorld._previewAnimation = false;
547 transitionStopRule = "*" 546 glCanvas.elementModel.shapeModel.GLWorld._canvas.task.stop();
548 this.stage.bindingView.hide = false;
549 }
550
551 this.application.ninja.stylesController._stageStylesheet.rules[0].selectorText = transitionStopRule;
552
553 this._toggleWebGlAnimation(this.appModel.livePreview);
554 }
555 },
556
557 // Turn on WebGL animation during preview
558 _toggleWebGlAnimation: {
559 value: function(inLivePreview) {
560 var glCanvases = this.currentDocument.model.views.design.iframe.contentWindow.document.querySelectorAll('[data-RDGE-id]'),
561 glShapeModel;
562 if(glCanvases) {
563 for(var i = 0, len = glCanvases.length; i<len; i++) {
564 glShapeModel = glCanvases[i].elementModel.shapeModel;
565 if(inLivePreview) {
566 glShapeModel.GLWorld._previewAnimation = true;
567 glShapeModel.GLWorld.restartRenderLoop();
568 } else if (!glShapeModel.animate ) {
569 glShapeModel.GLWorld._previewAnimation = false;
570 glShapeModel.GLWorld._canvas.task.stop();
571 }
572 } 547 }
573 } 548 });
574 } 549 }
575 }, 550 },
576 551