aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-22 17:17:48 -0700
committerValerio Virgillito2012-03-22 17:17:48 -0700
commitf6afc520f357dec8daeb9b9e748f99c8d8508f7c (patch)
treee227e049aacac52cfb75354e5f1d44e2a13c3617 /js
parentc38309949f9d84f86e769ea827950cc88440603f (diff)
parentccbbf1318fcf21409f0b1841119b49fadd92f83d (diff)
downloadninja-f6afc520f357dec8daeb9b9e748f99c8d8508f7c.tar.gz
Merge pull request #133 from mqg734/WebGL-Animation-CheckBox
Web gl animation check box
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js13
-rwxr-xr-xjs/data/pi/pi-data.js30
-rwxr-xr-xjs/models/shape-model.js3
-rwxr-xr-xjs/ninja.reel/ninja.js19
4 files changed, 64 insertions, 1 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index b3ac9ddb..9b2fa618 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -105,6 +105,18 @@ exports.ShapesController = Montage.create(CanvasController, {
105 case "editFillMaterial": 105 case "editFillMaterial":
106 NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()}); 106 NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()});
107 break; 107 break;
108 case "animate":
109 if(value)
110 {
111 el.elementModel.shapeModel.animate = true;
112 el.elementModel.shapeModel.GLWorld.restartRenderLoop();
113 }
114 else
115 {
116 el.elementModel.shapeModel.animate = false;
117 el.elementModel.shapeModel.GLWorld._canvas.task.stop();
118 }
119 break;
108 default: 120 default:
109 CanvasController.setProperty(el, p, value); 121 CanvasController.setProperty(el, p, value);
110 } 122 }
@@ -123,6 +135,7 @@ exports.ShapesController = Montage.create(CanvasController, {
123 case "border": 135 case "border":
124 case "background": 136 case "background":
125 case "useWebGl": 137 case "useWebGl":
138 case "animate":
126 return this.getShapeProperty(el, p); 139 return this.getShapeProperty(el, p);
127 case "strokeMaterial": 140 case "strokeMaterial":
128 case "fillMaterial": 141 case "fillMaterial":
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index 53fec3be..56337124 100755
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -393,6 +393,16 @@ exports.PiData = Montage.create( Montage, {
393 ], 393 ],
394 [ 394 [
395 { 395 {
396 type: "checkbox",
397 id: "animate",
398 prop: "animate",
399 defaultValue: true,
400 value: "Animate",
401 checked: true
402 }
403 ],
404 [
405 {
396 type: "dropdown", 406 type: "dropdown",
397 id: "strokeMaterial", 407 id: "strokeMaterial",
398 prop: "strokeMaterial", 408 prop: "strokeMaterial",
@@ -486,6 +496,16 @@ exports.PiData = Montage.create( Montage, {
486 ], 496 ],
487 [ 497 [
488 { 498 {
499 type: "checkbox",
500 id: "animate",
501 prop: "animate",
502 defaultValue: true,
503 value: "Animate",
504 checked: true
505 }
506 ],
507 [
508 {
489 type: "dropdown", 509 type: "dropdown",
490 id: "strokeMaterial", 510 id: "strokeMaterial",
491 prop: "strokeMaterial", 511 prop: "strokeMaterial",
@@ -580,6 +600,16 @@ exports.PiData = Montage.create( Montage, {
580 ], 600 ],
581 [ 601 [
582 { 602 {
603 type: "checkbox",
604 id: "animate",
605 prop: "animate",
606 defaultValue: true,
607 value: "Animate",
608 checked: true
609 }
610 ],
611 [
612 {
583 type: "dropdown", 613 type: "dropdown",
584 id: "strokeMaterial", 614 id: "strokeMaterial",
585 prop: "strokeMaterial", 615 prop: "strokeMaterial",
diff --git a/js/models/shape-model.js b/js/models/shape-model.js
index 58a88fd0..ea8c2cfc 100755
--- a/js/models/shape-model.js
+++ b/js/models/shape-model.js
@@ -10,7 +10,8 @@ var Montage = require("montage/core/core").Montage,
10exports.ShapeModel = Montage.create(Component, { 10exports.ShapeModel = Montage.create(Component, {
11 11
12 shapeCount: { value: 0 }, 12 shapeCount: { value: 0 },
13 useWebGl: { value: false }, 13 useWebGl: { value: false },
14 animate: { value: true },
14 15
15 GLWorld: { value: null }, 16 GLWorld: { value: null },
16 GLGeomObj: { value: null }, 17 GLGeomObj: { value: null },
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