aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js14
-rwxr-xr-xjs/lib/geom/geom-obj.js18
2 files changed, 24 insertions, 8 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index a4d53e50..5d3cf060 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -78,6 +78,7 @@ exports.ShapesController = Montage.create(CanvasController, {
78 this.toggleWebGlMode(el, value); 78 this.toggleWebGlMode(el, value);
79 el.elementModel.shapeModel.GLWorld.render(); 79 el.elementModel.shapeModel.GLWorld.render();
80 this.application.ninja.selectionController.selectElement(el); 80 this.application.ninja.selectionController.selectElement(el);
81 this.application.ninja.documentController.activeDocument.needsSave = true;
81 return; 82 return;
82 case "strokeMaterial": 83 case "strokeMaterial":
83 var sm = Object.create(MaterialsModel.getMaterial(value)); 84 var sm = Object.create(MaterialsModel.getMaterial(value));
@@ -145,6 +146,7 @@ exports.ShapesController = Montage.create(CanvasController, {
145 default: 146 default:
146 CanvasController.setProperty(el, p, value); 147 CanvasController.setProperty(el, p, value);
147 } 148 }
149 this.application.ninja.documentController.activeDocument.needsSave = true;
148 } 150 }
149 }, 151 },
150 152
@@ -422,8 +424,7 @@ exports.ShapesController = Montage.create(CanvasController, {
422 setColor: { 424 setColor: {
423 value: function(el, color, isFill) { 425 value: function(el, color, isFill) {
424 var mode = color.mode, 426 var mode = color.mode,
425 webGl, 427 webGl;
426 m;
427 if(isFill) 428 if(isFill)
428 { 429 {
429 if(mode) 430 if(mode)
@@ -431,14 +432,13 @@ exports.ShapesController = Montage.create(CanvasController, {
431 switch (mode) { 432 switch (mode) {
432 case 'nocolor': 433 case 'nocolor':
433 el.elementModel.shapeModel.GLGeomObj.setFillColor(null); 434 el.elementModel.shapeModel.GLGeomObj.setFillColor(null);
434 return; 435 break;
435 case 'gradient': 436 case 'gradient':
436 if(el.elementModel.shapeModel.useWebGl) 437 if(el.elementModel.shapeModel.useWebGl)
437 { 438 {
438 this._setGradientMaterial(el, color.color.gradientMode, isFill); 439 this._setGradientMaterial(el, color.color.gradientMode, isFill);
439 } 440 }
440 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 441 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops});
441 el.elementModel.shapeModel.GLWorld.render();
442 break; 442 break;
443 default: 443 default:
444 if(el.elementModel.shapeModel.useWebGl) 444 if(el.elementModel.shapeModel.useWebGl)
@@ -447,7 +447,6 @@ exports.ShapesController = Montage.create(CanvasController, {
447 } 447 }
448 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 448 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
449 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 449 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
450 el.elementModel.shapeModel.GLWorld.render();
451 } 450 }
452 } 451 }
453 } 452 }
@@ -468,14 +467,13 @@ exports.ShapesController = Montage.create(CanvasController, {
468 switch (mode) { 467 switch (mode) {
469 case 'nocolor': 468 case 'nocolor':
470 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(null); 469 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(null);
471 return; 470 break;
472 case 'gradient': 471 case 'gradient':
473 if(el.elementModel.shapeModel.useWebGl) 472 if(el.elementModel.shapeModel.useWebGl)
474 { 473 {
475 this._setGradientMaterial(el, color.color.gradientMode, isFill); 474 this._setGradientMaterial(el, color.color.gradientMode, isFill);
476 } 475 }
477 el.elementModel.shapeModel.GLGeomObj.setStrokeColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 476 el.elementModel.shapeModel.GLGeomObj.setStrokeColor({gradientMode:color.color.gradientMode, color:color.color.stops});
478 el.elementModel.shapeModel.GLWorld.render();
479 break; 477 break;
480 default: 478 default:
481 if(el.elementModel.shapeModel.useWebGl) 479 if(el.elementModel.shapeModel.useWebGl)
@@ -484,11 +482,11 @@ exports.ShapesController = Montage.create(CanvasController, {
484 } 482 }
485 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 483 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
486 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 484 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
487 el.elementModel.shapeModel.GLWorld.render();
488 } 485 }
489 } 486 }
490 } 487 }
491 el.elementModel.shapeModel.GLWorld.render(); 488 el.elementModel.shapeModel.GLWorld.render();
489 this.application.ninja.documentController.activeDocument.needsSave = true;
492 } 490 }
493 }, 491 },
494 492
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index ce06498d..44daa291 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -196,6 +196,24 @@ var GeomObj = function GLGeomObj() {
196 } 196 }
197 } 197 }
198 } 198 }
199 } else {
200 if (type === "fill") {
201 this._fillColor = null;
202 } else {
203 this._strokeColor = null;
204 }
205
206 if (this._materialArray && this._materialTypeArray) {
207 nMats = this._materialArray.length;
208 if (nMats === this._materialTypeArray.length) {
209 for (i=0; i<nMats; i++) {
210 if (this._materialTypeArray[i] == type) {
211 // TODO - Not sure how to set color to null values in shaders
212 this._materialArray[i].setProperty( "color", [0,0,0,0] );
213 }
214 }
215 }
216 }
199 } 217 }
200 218
201 var world = this.getWorld(); 219 var world = this.getWorld();