aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-06 10:58:25 -0800
committerValerio Virgillito2012-03-06 10:58:25 -0800
commit84332ab81c1b445195f1d9be8bbeae0725c8e758 (patch)
treee322baa1f98d4507ec255279198fa2284b2dff3c /js/controllers/elements
parent13f52cf0c74f53a919fa864f86669e8155f82961 (diff)
downloadninja-84332ab81c1b445195f1d9be8bbeae0725c8e758.tar.gz
Squashed commit of preload-fix into Master
- Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 749a1dd9..3423a5a7 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -8,6 +8,9 @@ var Montage = require("montage/core/core").Montage,
8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, 8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController,
9 njModule = require("js/lib/NJUtils"); 9 njModule = require("js/lib/NJUtils");
10 10
11var World = require("js/lib/drawing/world").World;
12var MaterialsModel = require("js/models/materials-model").MaterialsModel;
13
11exports.ShapesController = Montage.create(CanvasController, { 14exports.ShapesController = Montage.create(CanvasController, {
12 15
13 setProperty: { 16 setProperty: {
@@ -78,7 +81,7 @@ exports.ShapesController = Montage.create(CanvasController, {
78 this.application.ninja.selectionController.selectElement(el); 81 this.application.ninja.selectionController.selectElement(el);
79 return; 82 return;
80 case "strokeMaterial": 83 case "strokeMaterial":
81 var sm = Object.create(MaterialsLibrary.getMaterial(value)); 84 var sm = Object.create(MaterialsModel.getMaterial(value));
82 if(sm) 85 if(sm)
83 { 86 {
84 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); 87 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
@@ -88,7 +91,7 @@ exports.ShapesController = Montage.create(CanvasController, {
88 } 91 }
89 break; 92 break;
90 case "fillMaterial": 93 case "fillMaterial":
91 var fm = Object.create(MaterialsLibrary.getMaterial(value)); 94 var fm = Object.create(MaterialsModel.getMaterial(value));
92 if(fm) 95 if(fm)
93 { 96 {
94 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); 97 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
@@ -317,7 +320,7 @@ exports.ShapesController = Montage.create(CanvasController, {
317 optionItem.innerText = "Default"; 320 optionItem.innerText = "Default";
318 cb.appendChild(optionItem); 321 cb.appendChild(optionItem);
319 322
320 var materials = MaterialsLibrary.materials; 323 var materials = this.application.ninja.appModel.materials;
321 var len = materials.length; 324 var len = materials.length;
322 325
323 var i; 326 var i;
@@ -366,19 +369,19 @@ exports.ShapesController = Montage.create(CanvasController, {
366 worldData = el.elementModel.shapeModel.GLWorld.export(); 369 worldData = el.elementModel.shapeModel.GLWorld.export();
367 if(worldData) 370 if(worldData)
368 { 371 {
369 world = new GLWorld(el, true); 372 world = new World(el, true);
370 el.elementModel.shapeModel.GLWorld = world; 373 el.elementModel.shapeModel.GLWorld = world;
371 el.elementModel.shapeModel.useWebGl = true; 374 el.elementModel.shapeModel.useWebGl = true;
372 world.import(worldData); 375 world.import(worldData);
373 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); 376 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
374 377
375 sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); 378 sm = Object.create(MaterialsModel.getMaterial("FlatMaterial"));
376 if(sm) 379 if(sm)
377 { 380 {
378 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); 381 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
379 el.elementModel.shapeModel.strokeMaterial = sm; 382 el.elementModel.shapeModel.strokeMaterial = sm;
380 } 383 }
381 fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); 384 fm = Object.create(MaterialsModel.getMaterial("FlatMaterial"));
382 // TODO - Use consts after GL code is converted to object literal notation 385 // TODO - Use consts after GL code is converted to object literal notation
383// if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) ) 386// if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) )
384 if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) ) 387 if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) )
@@ -402,7 +405,7 @@ exports.ShapesController = Montage.create(CanvasController, {
402 worldData = el.elementModel.shapeModel.GLWorld.export(); 405 worldData = el.elementModel.shapeModel.GLWorld.export();
403 if(worldData) 406 if(worldData)
404 { 407 {
405 world = new GLWorld(el, false); 408 world = new World(el, false);
406 el.elementModel.shapeModel.GLWorld = world; 409 el.elementModel.shapeModel.GLWorld = world;
407 el.elementModel.shapeModel.useWebGl = false; 410 el.elementModel.shapeModel.useWebGl = false;
408 world.import(worldData); 411 world.import(worldData);