aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-22 16:53:23 -0700
committerNivesh Rajbhandari2012-03-22 16:53:23 -0700
commitccbbf1318fcf21409f0b1841119b49fadd92f83d (patch)
treeb10c9520fedd06189113e4cae834162e812f93b4
parente52b0dcb9540b854a341a881de2d26aa753e9a82 (diff)
downloadninja-ccbbf1318fcf21409f0b1841119b49fadd92f83d.tar.gz
Start WebGL animation during live preview. And set WebGL animation back to user preference when closing live preview.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/ninja.reel/ninja.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index 2a6e49f7..7db2a82c 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -166,6 +166,25 @@ exports.Ninja = Montage.create(Component, {
166 this.currentDocument.documentRoot.elementModel.controller.setProperty(this.currentDocument.documentRoot, "overflow", overflow); 166 this.currentDocument.documentRoot.elementModel.controller.setProperty(this.currentDocument.documentRoot, "overflow", overflow);
167 this.currentDocument.documentRoot.elementModel.controller.changeSelector(this.currentDocument.documentRoot, "transitionStopRule", transitionStopRule); 167 this.currentDocument.documentRoot.elementModel.controller.changeSelector(this.currentDocument.documentRoot, "transitionStopRule", transitionStopRule);
168 168
169 this._toggleWebGlAnimation(this.appModel.livePreview);
170 }
171 },
172
173 // Turn on WebGL animation during preview
174 _toggleWebGlAnimation: {
175 value: function(inLivePreview) {
176 var glCanvases = this.currentDocument.iframe.contentWindow.document.querySelectorAll('[data-RDGE-id]'),
177 glShapeModel;
178 if(glCanvases) {
179 for(var i = 0, len = glCanvases.length; i<len; i++) {
180 glShapeModel = glCanvases[i].elementModel.shapeModel;
181 if(inLivePreview) {
182 glShapeModel.GLWorld.restartRenderLoop();
183 } else if (!glShapeModel.animate ) {
184 glShapeModel.GLWorld._canvas.task.stop();
185 }
186 }
187 }
169 } 188 }
170 }, 189 },
171 190