diff options
author | Jose Antonio Marquez | 2012-02-09 15:02:51 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-09 15:02:51 -0800 |
commit | 67a5b6a1fb352bdc69ff05297268c27e7e2ba795 (patch) | |
tree | 8483701ec4d16143a2517b82a8148a7c5a456b0c /js/controllers | |
parent | 74efc1238f51e9c0ffdeffe2a349f66011ef9f17 (diff) | |
parent | 666ae3e9119410cbf7fa974274d95336aaff091c (diff) | |
download | ninja-67a5b6a1fb352bdc69ff05297268c27e7e2ba795.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into FileIO
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | 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 100755 --- 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 | ||