aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-08 14:24:48 -0800
committerNivesh Rajbhandari2012-02-08 14:24:48 -0800
commit2d68f944e93b201deb46015392e706b7a24201c9 (patch)
tree55367f4efb8a49447753e473af52f878f1584b64 /js/controllers
parent79ef4e4f51f8981feac3f3bddb6a06aa37407542 (diff)
downloadninja-2d68f944e93b201deb46015392e706b7a24201c9.tar.gz
Fixed several typos in Materials import/export code to support toggling between 2d and 3d shape modes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/elements/shapes-controller.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index e764de4e..b9c033aa 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -63,11 +63,11 @@ exports.ShapesController = Montage.create(CanvasController, {
63 canvas.height = el.height; 63 canvas.height = el.height;
64 this.application.ninja.elementMediator.replaceElement(el, canvas); 64 this.application.ninja.elementMediator.replaceElement(el, canvas);
65 NJevent("elementDeleted", el); 65 NJevent("elementDeleted", el);
66 this.application.ninja.selectionController.selectElement(canvas);
67 el = canvas; 66 el = canvas;
68 this.toggleWebGlMode(el, value); 67 this.toggleWebGlMode(el, value);
69 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 68 el.elementModel.shapeModel.GLWorld.render();
70 break; 69 this.application.ninja.selectionController.selectElement(el);
70 return;
71 case "strokeMaterial": 71 case "strokeMaterial":
72 var sm = Object.create(MaterialsLibrary.getMaterial(value)); 72 var sm = Object.create(MaterialsLibrary.getMaterial(value));
73 if(sm) 73 if(sm)
@@ -338,13 +338,26 @@ exports.ShapesController = Montage.create(CanvasController, {
338 { 338 {
339 return; 339 return;
340 } 340 }
341 var world, 341 var sm,
342 fm,
343 world,
342 worldData = el.elementModel.shapeModel.GLWorld.export(); 344 worldData = el.elementModel.shapeModel.GLWorld.export();
343 if(worldData) 345 if(worldData)
344 { 346 {
345 world = new GLWorld(el, true); 347 world = new GLWorld(el, true);
346 el.elementModel.shapeModel.GLWorld = world; 348 el.elementModel.shapeModel.GLWorld = world;
349 el.elementModel.shapeModel.GLGeomObj.setWorld(world);
347 el.elementModel.shapeModel.useWebGl = true; 350 el.elementModel.shapeModel.useWebGl = true;
351 sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial"));
352 fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial"));
353 if(sm && fm)
354 {
355 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
356 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
357 el.elementModel.shapeModel.strokeMaterial = sm;
358 el.elementModel.shapeModel.fillMaterial = fm;
359 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
360 }
348 world.import(worldData); 361 world.import(worldData);
349 } 362 }
350 363
@@ -365,6 +378,10 @@ exports.ShapesController = Montage.create(CanvasController, {
365 world = new GLWorld(el, false); 378 world = new GLWorld(el, false);
366 el.elementModel.shapeModel.GLWorld = world; 379 el.elementModel.shapeModel.GLWorld = world;
367 el.elementModel.shapeModel.useWebGl = false; 380 el.elementModel.shapeModel.useWebGl = false;
381 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null);
382 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(null);
383 el.elementModel.shapeModel.strokeMaterial = null;
384 el.elementModel.shapeModel.fillMaterial = null;
368 world.import(worldData); 385 world.import(worldData);
369 } 386 }
370 387