diff options
author | Jose Antonio Marquez | 2012-02-11 22:33:26 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-11 22:33:26 -0800 |
commit | c6ed3331e88eb01a52ac533e5449df3af2fb5965 (patch) | |
tree | 2b660dc94a98bad02b46ba44a28424d692435fb3 /js/controllers/elements | |
parent | 5d38e575b2bafeae9bd676247fce15ec5f78fa32 (diff) | |
parent | e142611e22718b1f1d1696902ad9161ec5f33f98 (diff) | |
download | ninja-c6ed3331e88eb01a52ac533e5449df3af2fb5965.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/controllers/elements')
-rw-r--r-- | js/controllers/elements/shapes-controller.js | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 39300eb8..f69e6fc9 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -43,11 +43,11 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
43 | canvas.height = el.height; | 43 | canvas.height = el.height; |
44 | this.application.ninja.elementMediator.replaceElement(el, canvas); | 44 | this.application.ninja.elementMediator.replaceElement(el, canvas); |
45 | NJevent("elementDeleted", el); | 45 | NJevent("elementDeleted", el); |
46 | this.application.ninja.selectionController.selectElement(canvas); | ||
47 | el = canvas; | 46 | el = canvas; |
48 | this.toggleWebGlMode(el, value); | 47 | this.toggleWebGlMode(el, value); |
49 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | 48 | el.elementModel.shapeModel.GLWorld.render(); |
50 | break; | 49 | this.application.ninja.selectionController.selectElement(el); |
50 | return; | ||
51 | case "strokeMaterial": | 51 | case "strokeMaterial": |
52 | var sm = Object.create(MaterialsLibrary.getMaterial(value)); | 52 | var sm = Object.create(MaterialsLibrary.getMaterial(value)); |
53 | if(sm) | 53 | if(sm) |
@@ -318,7 +318,9 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
318 | { | 318 | { |
319 | return; | 319 | return; |
320 | } | 320 | } |
321 | var world, | 321 | var sm, |
322 | fm, | ||
323 | world, | ||
322 | worldData = el.elementModel.shapeModel.GLWorld.export(); | 324 | worldData = el.elementModel.shapeModel.GLWorld.export(); |
323 | if(worldData) | 325 | if(worldData) |
324 | { | 326 | { |
@@ -326,6 +328,22 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
326 | el.elementModel.shapeModel.GLWorld = world; | 328 | el.elementModel.shapeModel.GLWorld = world; |
327 | el.elementModel.shapeModel.useWebGl = true; | 329 | el.elementModel.shapeModel.useWebGl = true; |
328 | world.import(worldData); | 330 | world.import(worldData); |
331 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); | ||
332 | |||
333 | sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); | ||
334 | if(sm) | ||
335 | { | ||
336 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); | ||
337 | el.elementModel.shapeModel.strokeMaterial = sm; | ||
338 | } | ||
339 | fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); | ||
340 | // TODO - Use consts after GL code is converted to object literal notation | ||
341 | // if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) ) | ||
342 | if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) ) | ||
343 | { | ||
344 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); | ||
345 | el.elementModel.shapeModel.fillMaterial = fm; | ||
346 | } | ||
329 | } | 347 | } |
330 | 348 | ||
331 | } | 349 | } |
@@ -346,8 +364,16 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
346 | el.elementModel.shapeModel.GLWorld = world; | 364 | el.elementModel.shapeModel.GLWorld = world; |
347 | el.elementModel.shapeModel.useWebGl = false; | 365 | el.elementModel.shapeModel.useWebGl = false; |
348 | world.import(worldData); | 366 | world.import(worldData); |
367 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); | ||
368 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); | ||
369 | el.elementModel.shapeModel.strokeMaterial = null; | ||
370 | // TODO - Use consts after GL code is converted to object literal notation | ||
371 | if(el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) | ||
372 | { | ||
373 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(null); | ||
374 | el.elementModel.shapeModel.fillMaterial = null; | ||
375 | } | ||
349 | } | 376 | } |
350 | |||
351 | } | 377 | } |
352 | } | 378 | } |
353 | 379 | ||