diff options
Diffstat (limited to 'js/ninja.reel')
-rwxr-xr-x | js/ninja.reel/ninja.html | 22 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 52 |
2 files changed, 19 insertions, 55 deletions
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 17726712..fbbfd066 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html | |||
@@ -52,10 +52,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
52 | }, | 52 | }, |
53 | 53 | ||
54 | "appModel": { | 54 | "appModel": { |
55 | "prototype": "js/models/app-model", | 55 | "prototype": "js/models/app-model" |
56 | "bindings": { | ||
57 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} | ||
58 | } | ||
59 | }, | 56 | }, |
60 | 57 | ||
61 | "materialsModel": { | 58 | "materialsModel": { |
@@ -63,7 +60,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
63 | }, | 60 | }, |
64 | 61 | ||
65 | "menu": { | 62 | "menu": { |
66 | "prototype": "js/components/menu/menu.reel", | 63 | "prototype": "js/ui/menu/menu.reel", |
67 | "properties": { | 64 | "properties": { |
68 | "element": {"#": "mainMenuBar"} | 65 | "element": {"#": "mainMenuBar"} |
69 | }, | 66 | }, |
@@ -183,17 +180,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
183 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} | 180 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} |
184 | } | 181 | } |
185 | }, | 182 | }, |
186 | 183 | ||
187 | "stageMode": { | ||
188 | "prototype": "js/components/layout/stage-mode.reel", | ||
189 | "properties": { | ||
190 | "element": {"#": "stageMode"} | ||
191 | }, | ||
192 | "bindings" : { | ||
193 | "chromePreview": {"<->": "@appModel.chromePreview"} | ||
194 | } | ||
195 | }, | ||
196 | |||
197 | "toolsList": { | 184 | "toolsList": { |
198 | "prototype": "js/components/layout/tools-list.reel", | 185 | "prototype": "js/components/layout/tools-list.reel", |
199 | "properties": { | 186 | "properties": { |
@@ -281,7 +268,8 @@ POSSIBILITY OF SUCH DAMAGE. | |||
281 | "timeline": { | 268 | "timeline": { |
282 | "prototype": "js/panels/Timeline/TimelinePanel.reel", | 269 | "prototype": "js/panels/Timeline/TimelinePanel.reel", |
283 | "properties": { | 270 | "properties": { |
284 | "element": {"#": "timelinePanelComponent"} | 271 | "element": {"#": "timelinePanelComponent"}, |
272 | "stage": {"@": "stage"} | ||
285 | }, | 273 | }, |
286 | "bindings": { | 274 | "bindings": { |
287 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} | 275 | "currentDocument": {"<-": "@documentList.selectedObjects.0"} |
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 9fd71b1c..24e47612 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -351,6 +351,7 @@ exports.Ninja = Montage.create(Component, { | |||
351 | this.ninjaVersion = window.ninjaVersion.ninja.version; | 351 | this.ninjaVersion = window.ninjaVersion.ninja.version; |
352 | this.undoManager = document.application.undoManager = UndoManager.create(); | 352 | this.undoManager = document.application.undoManager = UndoManager.create(); |
353 | document.application.njUtils = NjUtils; | 353 | document.application.njUtils = NjUtils; |
354 | document.application.model = this.appModel; | ||
354 | } | 355 | } |
355 | }, | 356 | }, |
356 | 357 | ||
@@ -376,9 +377,8 @@ exports.Ninja = Montage.create(Component, { | |||
376 | 377 | ||
377 | this.eventManager.addEventListener("selectTool", this, false); | 378 | this.eventManager.addEventListener("selectTool", this, false); |
378 | this.eventManager.addEventListener("selectSubTool", this, false); | 379 | this.eventManager.addEventListener("selectSubTool", this, false); |
380 | this.eventManager.addEventListener("executePreview", this, false); | ||
379 | 381 | ||
380 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); | ||
381 | this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); | ||
382 | this.addPropertyChangeListener("appModel.debug", this.toggleDebug, false); | 382 | this.addPropertyChangeListener("appModel.debug", this.toggleDebug, false); |
383 | } | 383 | } |
384 | }, | 384 | }, |
@@ -387,7 +387,7 @@ exports.Ninja = Montage.create(Component, { | |||
387 | //////////////////////////////////////////////////////////////////// | 387 | //////////////////////////////////////////////////////////////////// |
388 | //////////////////////////////////////////////////////////////////// | 388 | //////////////////////////////////////////////////////////////////// |
389 | //TODO: Expand method to allow other browsers for preview | 389 | //TODO: Expand method to allow other browsers for preview |
390 | executeChromePreview: { | 390 | handleExecutePreview: { |
391 | value: function () { | 391 | value: function () { |
392 | //TODO: Make into proper component | 392 | //TODO: Make into proper component |
393 | this.saveOperationScreen = {}; | 393 | this.saveOperationScreen = {}; |
@@ -534,42 +534,18 @@ exports.Ninja = Montage.create(Component, { | |||
534 | } | 534 | } |
535 | }, | 535 | }, |
536 | 536 | ||
537 | executeLivePreview: { | 537 | // Turn on WebGL animation on/off |
538 | value: function() { | 538 | toggleWebGlAnimation: { |
539 | var transitionStopRule; | 539 | value: function(animate) { |
540 | // this.stage.hideCanvas(this.appModel.livePreview); | 540 | Array.prototype.slice.call(elt.querySelectorAll('[data-RDGE-id]'),0).forEach(function(glCanvas) { |
541 | 541 | if(animate) { | |
542 | if(this.appModel.livePreview) { | 542 | glCanvas.elementModel.shapeModel.GLWorld._previewAnimation = true; |
543 | transitionStopRule = "nj-css-garbage-selector"; | 543 | glCanvas.elementModel.shapeModel.GLWorld.restartRenderLoop(); |
544 | this.stage.bindingView.hide = true; | 544 | } else if (!glCanvas.elementModel.shapeModel.animate ) { |
545 | } else { | 545 | glCanvas.elementModel.shapeModel.GLWorld._previewAnimation = false; |
546 | transitionStopRule = "*" | 546 | glCanvas.elementModel.shapeModel.GLWorld._canvas.task.stop(); |
547 | this.stage.bindingView.hide = false; | ||
548 | } | ||
549 | |||
550 | this.application.ninja.stylesController._stageStylesheet.rules[0].selectorText = transitionStopRule; | ||
551 | |||
552 | this._toggleWebGlAnimation(this.appModel.livePreview); | ||
553 | } | ||
554 | }, | ||
555 | |||
556 | // Turn on WebGL animation during preview | ||
557 | _toggleWebGlAnimation: { | ||
558 | value: function(inLivePreview) { | ||
559 | var glCanvases = this.currentDocument.model.views.design.iframe.contentWindow.document.querySelectorAll('[data-RDGE-id]'), | ||
560 | glShapeModel; | ||
561 | if(glCanvases) { | ||
562 | for(var i = 0, len = glCanvases.length; i<len; i++) { | ||
563 | glShapeModel = glCanvases[i].elementModel.shapeModel; | ||
564 | if(inLivePreview) { | ||
565 | glShapeModel.GLWorld._previewAnimation = true; | ||
566 | glShapeModel.GLWorld.restartRenderLoop(); | ||
567 | } else if (!glShapeModel.animate ) { | ||
568 | glShapeModel.GLWorld._previewAnimation = false; | ||
569 | glShapeModel.GLWorld._canvas.task.stop(); | ||
570 | } | ||
571 | } | 547 | } |
572 | } | 548 | }); |
573 | } | 549 | } |
574 | }, | 550 | }, |
575 | 551 | ||