diff options
author | Valerio Virgillito | 2012-02-09 13:41:45 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-09 13:41:45 -0800 |
commit | f5193cd04a2597051d88fced878efbc4802ea64c (patch) | |
tree | dc343dc98fa9f99133d9882bd9b92cfe81296d1a /js/controllers/elements/shapes-controller.js | |
parent | e2539230b8a297fa972af6d53fe9de3ef2ad43fa (diff) | |
parent | 666ae3e9119410cbf7fa974274d95336aaff091c (diff) | |
download | ninja-f5193cd04a2597051d88fced878efbc4802ea64c.tar.gz |
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rw-r--r-- | js/controllers/elements/shapes-controller.js | 25 |
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 | ||