aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-06 15:41:48 -0800
committerNivesh Rajbhandari2012-02-06 15:41:48 -0800
commit75486be2839494c9b54833aff8f5eef3f9542151 (patch)
treeb31d26275087bb8b6014a8cb2c1ffca8a3a28ef3 /js/controllers
parentf94b0c5ada403379b3ff8a900c2a2aabcecce49e (diff)
downloadninja-75486be2839494c9b54833aff8f5eef3f9542151.tar.gz
Support toggling between 2d and 3d canvas context. This requires us to create a new canvas with all the same values as the canvas being replaced and copying over all the shape data.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/elements/shapes-controller.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 74c88084..ed45710d 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -5,7 +5,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController; 8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController,
9 njModule = require("js/lib/NJUtils");
9 10
10exports.ShapesController = Montage.create(CanvasController, { 11exports.ShapesController = Montage.create(CanvasController, {
11 12
@@ -57,9 +58,11 @@ exports.ShapesController = Montage.create(CanvasController, {
57 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 58 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
58 break; 59 break;
59 case "useWebGl": 60 case "useWebGl":
60// this.toggleWebGlMode(el, value); 61 var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true);
61// el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 62 this.application.ninja.elementMediator.replaceElement(el, canvas);
62 el.elementModel.shapeModel.useWebGl = value; 63 el = canvas;
64 this.toggleWebGlMode(el, value);
65 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
63 break; 66 break;
64 default: 67 default:
65 CanvasController.setProperty(el, p, value); 68 CanvasController.setProperty(el, p, value);