aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-25 13:34:04 -0700
committerNivesh Rajbhandari2012-04-25 13:34:04 -0700
commit32a24988add5ba0ecf80caa31871cdd90e3eea5b (patch)
treefbf05f2dfc91e57ab9598046ff16798ea0ae1966 /js/controllers/elements/shapes-controller.js
parent60d6346a78fb5257eaf36f17a5fcb764a342c012 (diff)
parentd3a6350163ada5644d34ed8d5c2a00cef4db2afc (diff)
downloadninja-32a24988add5ba0ecf80caa31871cdd90e3eea5b.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLMaterials
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js59
1 files changed, 32 insertions, 27 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 14cdc473..e9dde5fc 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -74,12 +74,9 @@ exports.ShapesController = Montage.create(CanvasController, {
74 w += delta; 74 w += delta;
75 h += delta; 75 h += delta;
76 } 76 }
77 this.application.ninja.elementMediator.setProperties([el], 77
78 { "left": [l + "px"], 78 this.application.ninja.elementMediator.setProperties([{element:el, properties:{left: l + "px", top: t + "px", width: w + "px", height:h + "px"}}], eventType, source);
79 "top": [t + "px"], 79
80 "width": [w + "px"],
81 "height": [h + "px"] },
82 eventType, source );
83 } 80 }
84 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val); 81 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(val);
85 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 82 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
@@ -399,8 +396,8 @@ exports.ShapesController = Montage.create(CanvasController, {
399 if(isFill) 396 if(isFill)
400 { 397 {
401 // Properties Panel asks for fill color even for shapes that only have strokes 398 // Properties Panel asks for fill color even for shapes that only have strokes
402 // Check that shape object has a getFillColor method before getting fills 399 // Check that shape object supports fills
403 if(el.elementModel.shapeModel.GLGeomObj.getFillColor) 400 if(el.elementModel.shapeModel.GLGeomObj.canFill)
404 { 401 {
405 return this.application.ninja.colorController.colorModel.webGlToColor(el.elementModel.shapeModel.GLGeomObj.getFillColor()); 402 return this.application.ninja.colorController.colorModel.webGlToColor(el.elementModel.shapeModel.GLGeomObj.getFillColor());
406 } 403 }
@@ -497,28 +494,36 @@ exports.ShapesController = Montage.create(CanvasController, {
497 webGl; 494 webGl;
498 if(isFill) 495 if(isFill)
499 { 496 {
500 if(mode) 497 // skip shape types that don't have fill color
498 if(el.elementModel.shapeModel.GLGeomObj.canFill)
501 { 499 {
502 switch (mode) { 500 if(mode)
503 case 'nocolor': 501 {
504 el.elementModel.shapeModel.GLGeomObj.setFillColor(null); 502 switch (mode) {
505 break; 503 case 'nocolor':
506 case 'gradient': 504 el.elementModel.shapeModel.GLGeomObj.setFillColor(null);
507 if(el.elementModel.shapeModel.useWebGl) 505 break;
508 { 506 case 'gradient':
509 this._setGradientMaterial(el, color.color.gradientMode, isFill); 507 if(el.elementModel.shapeModel.useWebGl)
510 } 508 {
511 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 509 this._setGradientMaterial(el, color.color.gradientMode, isFill);
512 break; 510 }
513 default: 511 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops});
514 if(el.elementModel.shapeModel.useWebGl) 512 break;
515 { 513 default:
516 this._setFlatMaterial(el, isFill); 514 if(el.elementModel.shapeModel.useWebGl)
517 } 515 {
518 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 516 this._setFlatMaterial(el, isFill);
519 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 517 }
518 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
519 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
520 }
520 } 521 }
521 } 522 }
523 else
524 {
525 return;
526 }
522 } 527 }
523 else 528 else
524 { 529 {