aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorEric Guzman2012-02-13 10:29:49 -0800
committerEric Guzman2012-02-13 10:29:49 -0800
commite4893f7d3c3b9bd7967973197c3ffb5d3a075c91 (patch)
treef3d4fd9d96ba0dcf846fbf66153fb443bd60f767 /js/controllers/elements
parentef032412216d437ce1c7dfc9050ab41adf0594c0 (diff)
parente142611e22718b1f1d1696902ad9161ec5f33f98 (diff)
downloadninja-e4893f7d3c3b9bd7967973197c3ffb5d3a075c91.tar.gz
Merge branch 'refs/heads/master' into TreeComponents
Diffstat (limited to 'js/controllers/elements')
-rw-r--r--js/controllers/elements/shapes-controller.js36
1 files changed, 31 insertions, 5 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index e764de4e..640119c4 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,7 +338,9 @@ 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 {
@@ -346,6 +348,22 @@ exports.ShapesController = Montage.create(CanvasController, {
346 el.elementModel.shapeModel.GLWorld = world; 348 el.elementModel.shapeModel.GLWorld = world;
347 el.elementModel.shapeModel.useWebGl = true; 349 el.elementModel.shapeModel.useWebGl = true;
348 world.import(worldData); 350 world.import(worldData);
351 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
352
353 sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial"));
354 if(sm)
355 {
356 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
357 el.elementModel.shapeModel.strokeMaterial = sm;
358 }
359 fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial"));
360 // TODO - Use consts after GL code is converted to object literal notation
361// if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) )
362 if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) )
363 {
364 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
365 el.elementModel.shapeModel.fillMaterial = fm;
366 }
349 } 367 }
350 368
351 } 369 }
@@ -366,8 +384,16 @@ exports.ShapesController = Montage.create(CanvasController, {
366 el.elementModel.shapeModel.GLWorld = world; 384 el.elementModel.shapeModel.GLWorld = world;
367 el.elementModel.shapeModel.useWebGl = false; 385 el.elementModel.shapeModel.useWebGl = false;
368 world.import(worldData); 386 world.import(worldData);
387 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
388 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null);
389 el.elementModel.shapeModel.strokeMaterial = null;
390 // TODO - Use consts after GL code is converted to object literal notation
391 if(el.elementModel.shapeModel.GLGeomObj.geomType() !== 3)
392 {
393 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(null);
394 el.elementModel.shapeModel.fillMaterial = null;
395 }
369 } 396 }
370
371 } 397 }
372 } 398 }
373 399