diff options
author | Valerio Virgillito | 2012-07-19 15:53:54 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-19 15:53:54 -0700 |
commit | 6403ec6d21048c93138ddcbcc59fc4677121ed5e (patch) | |
tree | 43d371557e28383fb962cb86d1a478f3a35d7ff3 /js/ninja.reel | |
parent | fc13ef1e806116bb7ece5bb06604fa4f5714a6ed (diff) | |
download | ninja-6403ec6d21048c93138ddcbcc59fc4677121ed5e.tar.gz |
Timeline: updated livePreview to timeline play. Hide canvas and draw red outline
- Changed the play button to a toggle button
- livePreview code in stage activated via bindings
- Draw a red outline of the canvas when in play
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/ninja.reel')
-rwxr-xr-x | js/ninja.reel/ninja.html | 3 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 47 |
2 files changed, 13 insertions, 37 deletions
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 4f40a3f8..fbbfd066 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html | |||
@@ -268,7 +268,8 @@ POSSIBILITY OF SUCH DAMAGE. | |||
268 | "timeline": { | 268 | "timeline": { |
269 | "prototype": "js/panels/Timeline/TimelinePanel.reel", | 269 | "prototype": "js/panels/Timeline/TimelinePanel.reel", |
270 | "properties": { | 270 | "properties": { |
271 | "element": {"#": "timelinePanelComponent"} | 271 | "element": {"#": "timelinePanelComponent"}, |
272 | "stage": {"@": "stage"} | ||
272 | }, | 273 | }, |
273 | "bindings": { | 274 | "bindings": { |
274 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} | 275 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} |
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 | ||