diff options
author | Ananya Sen | 2012-07-20 12:19:09 -0700 |
---|---|---|
committer | Ananya Sen | 2012-07-20 12:19:09 -0700 |
commit | bf4bd611e6fadf45fa9dc50ad72902040075ff0c (patch) | |
tree | 6fcb99cc7f497dfdddb7fd0e00b80a9c7c911099 /js/ninja.reel/ninja.js | |
parent | 0d414eaeae13bb520e52ddace0a83c03eb9e7769 (diff) | |
parent | 9053e2037821a5c8405fabb74db9635deacfe8d5 (diff) | |
download | ninja-bf4bd611e6fadf45fa9dc50ad72902040075ff0c.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into copy-paste-bugfix
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-x | js/ninja.reel/ninja.js | 47 |
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 | ||