aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-09 13:42:59 -0800
committerPushkar Joshi2012-02-09 13:42:59 -0800
commit6bb00e69713bd7131b2bc0a15e4e0cb6071d616c (patch)
tree08d43d3c3a6777032ce51c503947874c02bf3947 /js/controllers/elements
parent5f42bd1f7723483d374cdd3fe51ef8298c86a1a2 (diff)
parent666ae3e9119410cbf7fa974274d95336aaff091c (diff)
downloadninja-6bb00e69713bd7131b2bc0a15e4e0cb6071d616c.tar.gz
Merge branch 'master' into brushtool
Diffstat (limited to 'js/controllers/elements')
-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