aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/canvas-controller.js8
-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
5 files changed, 45 insertions, 21 deletions
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js
index 7af7e824..b8894c18 100755
--- a/js/controllers/elements/canvas-controller.js
+++ b/js/controllers/elements/canvas-controller.js
@@ -33,5 +33,13 @@ exports.CanvasController = Montage.create(ElementController, {
33 ElementController.setProperty(el, p, value); 33 ElementController.setProperty(el, p, value);
34 } 34 }
35 } 35 }
36 },
37
38 setProperties: {
39 value: function(element, properties) {
40 for(var property in properties) {
41 this.setProperty(element, property, properties[property]);
42 }
43 }
36 } 44 }
37}); \ No newline at end of file 45}); \ No newline at end of file
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index cd7fa16d..e9dde5fc 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -396,8 +396,8 @@ exports.ShapesController = Montage.create(CanvasController, {
396 if(isFill) 396 if(isFill)
397 { 397 {
398 // 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
399 // Check that shape object has a getFillColor method before getting fills 399 // Check that shape object supports fills
400 if(el.elementModel.shapeModel.GLGeomObj.getFillColor) 400 if(el.elementModel.shapeModel.GLGeomObj.canFill)
401 { 401 {
402 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());
403 } 403 }
@@ -494,28 +494,36 @@ exports.ShapesController = Montage.create(CanvasController, {
494 webGl; 494 webGl;
495 if(isFill) 495 if(isFill)
496 { 496 {
497 if(mode) 497 // skip shape types that don't have fill color
498 if(el.elementModel.shapeModel.GLGeomObj.canFill)
498 { 499 {
499 switch (mode) { 500 if(mode)
500 case 'nocolor': 501 {
501 el.elementModel.shapeModel.GLGeomObj.setFillColor(null); 502 switch (mode) {
502 break; 503 case 'nocolor':
503 case 'gradient': 504 el.elementModel.shapeModel.GLGeomObj.setFillColor(null);
504 if(el.elementModel.shapeModel.useWebGl) 505 break;
505 { 506 case 'gradient':
506 this._setGradientMaterial(el, color.color.gradientMode, isFill); 507 if(el.elementModel.shapeModel.useWebGl)
507 } 508 {
508 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 509 this._setGradientMaterial(el, color.color.gradientMode, isFill);
509 break; 510 }
510 default: 511 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops});
511 if(el.elementModel.shapeModel.useWebGl) 512 break;
512 { 513 default:
513 this._setFlatMaterial(el, isFill); 514 if(el.elementModel.shapeModel.useWebGl)
514 } 515 {
515 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 516 this._setFlatMaterial(el, isFill);
516 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 }
517 } 521 }
518 } 522 }
523 else
524 {
525 return;
526 }
519 } 527 }
520 else 528 else
521 { 529 {
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;