From e52b0dcb9540b854a341a881de2d26aa753e9a82 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 22 Mar 2012 16:18:38 -0700 Subject: Adding checkbox in PI to start/stop WebGL animation preview. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 13 ++++++++++++ js/data/pi/pi-data.js | 30 ++++++++++++++++++++++++++++ js/models/shape-model.js | 3 ++- 3 files changed, 45 insertions(+), 1 deletion(-) (limited to 'js') 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, { case "editFillMaterial": NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()}); break; + case "animate": + if(value) + { + el.elementModel.shapeModel.animate = true; + el.elementModel.shapeModel.GLWorld.restartRenderLoop(); + } + else + { + el.elementModel.shapeModel.animate = false; + el.elementModel.shapeModel.GLWorld._canvas.task.stop(); + } + break; default: CanvasController.setProperty(el, p, value); } @@ -123,6 +135,7 @@ exports.ShapesController = Montage.create(CanvasController, { case "border": case "background": case "useWebGl": + case "animate": return this.getShapeProperty(el, p); case "strokeMaterial": 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 @@ -391,6 +391,16 @@ exports.PiData = Montage.create( Montage, { checked: false } ], + [ + { + type: "checkbox", + id: "animate", + prop: "animate", + defaultValue: true, + value: "Animate", + checked: true + } + ], [ { type: "dropdown", @@ -484,6 +494,16 @@ exports.PiData = Montage.create( Montage, { checked: false } ], + [ + { + type: "checkbox", + id: "animate", + prop: "animate", + defaultValue: true, + value: "Animate", + checked: true + } + ], [ { type: "dropdown", @@ -578,6 +598,16 @@ exports.PiData = Montage.create( Montage, { checked: false } ], + [ + { + type: "checkbox", + id: "animate", + prop: "animate", + defaultValue: true, + value: "Animate", + checked: true + } + ], [ { type: "dropdown", 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, exports.ShapeModel = Montage.create(Component, { shapeCount: { value: 0 }, - useWebGl: { value: false }, + useWebGl: { value: false }, + animate: { value: true }, GLWorld: { value: null }, GLGeomObj: { value: null }, -- cgit v1.2.3