aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-17 10:19:20 -0700
committerNivesh Rajbhandari2012-04-17 10:19:20 -0700
commit2a87a750f06003fc62e8e0e73983e14ce24fc7a7 (patch)
tree9566a079910cd08542ac7b35e8bc417dcecf8d1e
parentc253192a08b499ea7be46fa5438d273e51f7ec5a (diff)
downloadninja-2a87a750f06003fc62e8e0e73983e14ce24fc7a7.tar.gz
IKNinja-1477 - Cannot preflight Fill color if WebGL Line shape is selected.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/controllers/elements/shapes-controller.js50
-rwxr-xr-xjs/lib/geom/brush-stroke.js3
-rwxr-xr-xjs/lib/geom/geom-obj.js3
-rwxr-xr-xjs/lib/geom/line.js2
4 files changed, 37 insertions, 21 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 14cdc473..a446ef05 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -399,8 +399,8 @@ exports.ShapesController = Montage.create(CanvasController, {
399 if(isFill) 399 if(isFill)
400 { 400 {
401 // Properties Panel asks for fill color even for shapes that only have strokes 401 // 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 402 // Check that shape object supports fills
403 if(el.elementModel.shapeModel.GLGeomObj.getFillColor) 403 if(el.elementModel.shapeModel.GLGeomObj.canFill)
404 { 404 {
405 return this.application.ninja.colorController.colorModel.webGlToColor(el.elementModel.shapeModel.GLGeomObj.getFillColor()); 405 return this.application.ninja.colorController.colorModel.webGlToColor(el.elementModel.shapeModel.GLGeomObj.getFillColor());
406 } 406 }
@@ -497,28 +497,36 @@ exports.ShapesController = Montage.create(CanvasController, {
497 webGl; 497 webGl;
498 if(isFill) 498 if(isFill)
499 { 499 {
500 if(mode) 500 // skip shape types that don't have fill color
501 if(el.elementModel.shapeModel.GLGeomObj.canFill)
501 { 502 {
502 switch (mode) { 503 if(mode)
503 case 'nocolor': 504 {
504 el.elementModel.shapeModel.GLGeomObj.setFillColor(null); 505 switch (mode) {
505 break; 506 case 'nocolor':
506 case 'gradient': 507 el.elementModel.shapeModel.GLGeomObj.setFillColor(null);
507 if(el.elementModel.shapeModel.useWebGl) 508 break;
508 { 509 case 'gradient':
509 this._setGradientMaterial(el, color.color.gradientMode, isFill); 510 if(el.elementModel.shapeModel.useWebGl)
510 } 511 {
511 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 512 this._setGradientMaterial(el, color.color.gradientMode, isFill);
512 break; 513 }
513 default: 514 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops});
514 if(el.elementModel.shapeModel.useWebGl) 515 break;
515 { 516 default:
516 this._setFlatMaterial(el, isFill); 517 if(el.elementModel.shapeModel.useWebGl)
517 } 518 {
518 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 519 this._setFlatMaterial(el, isFill);
519 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 520 }
521 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
522 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
523 }
520 } 524 }
521 } 525 }
526 else
527 {
528 return;
529 }
522 } 530 }
523 else 531 else
524 { 532 {
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 26ac42e9..743dab85 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -44,6 +44,9 @@ var BrushStroke = function GLBrushStroke() {
44 this._strokeAngle = 0; 44 this._strokeAngle = 0;
45 this._strokeAmountSmoothing = 0; 45 this._strokeAmountSmoothing = 0;
46 46
47 // currently, brush does not support a fill region
48 this.canFill = false;
49
47 //threshold that tells us whether two samples are too far apart 50 //threshold that tells us whether two samples are too far apart
48 this._MAX_SAMPLE_DISTANCE_THRESHOLD = 5; 51 this._MAX_SAMPLE_DISTANCE_THRESHOLD = 5;
49 52
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index 2cde8a75..f2991bdb 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -47,6 +47,9 @@ var GeomObj = function GLGeomObj() {
47 this._fillMaterial = null; 47 this._fillMaterial = null;
48 this._strokeMaterial = null; 48 this._strokeMaterial = null;
49 49
50 // Shapes (such as lines) that don't support fill should set this to false
51 this.canFill = true;
52
50 // array of primitives - used in RDGE 53 // array of primitives - used in RDGE
51 this._primArray = []; 54 this._primArray = [];
52 this._materialNodeArray = []; 55 this._materialNodeArray = [];
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index 8ee39098..bb198d83 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -33,6 +33,8 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok
33 this._scaleX = 1.0; 33 this._scaleX = 1.0;
34 this._scaleY = 1.0; 34 this._scaleY = 1.0;
35 35
36 this.canFill = false;
37
36 if (arguments.length > 0) { 38 if (arguments.length > 0) {
37 this._width = width; 39 this._width = width;
38 this._height = height; 40 this._height = height;