aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js75
1 files changed, 56 insertions, 19 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 5920d51a..c3099459 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -139,7 +139,7 @@ exports.ShapesController = Montage.create(CanvasController, {
139 break; 139 break;
140 case "strokeMaterial": 140 case "strokeMaterial":
141 // skip shape types that don't support WebGL 141 // skip shape types that don't support WebGL
142 if(!el.elementModel.shapeModel.GLGeomObj.useWebGl) { 142 if(!el.elementModel.shapeModel.useWebGl) {
143 return; 143 return;
144 } 144 }
145 m = Object.create(MaterialsModel.getMaterial(value)); 145 m = Object.create(MaterialsModel.getMaterial(value));
@@ -157,7 +157,7 @@ exports.ShapesController = Montage.create(CanvasController, {
157 break; 157 break;
158 case "fillMaterial": 158 case "fillMaterial":
159 // skip shape types that don't support WebGL or fill color 159 // skip shape types that don't support WebGL or fill color
160 if(!el.elementModel.shapeModel.GLGeomObj.canFill || !el.elementModel.shapeModel.GLGeomObj.useWebGl) { 160 if(!el.elementModel.shapeModel.GLGeomObj.canFill || !el.elementModel.shapeModel.useWebGl) {
161 return; 161 return;
162 } 162 }
163 m = Object.create(MaterialsModel.getMaterial(value)); 163 m = Object.create(MaterialsModel.getMaterial(value));
@@ -453,17 +453,17 @@ exports.ShapesController = Montage.create(CanvasController, {
453 453
454 if(gradientM) 454 if(gradientM)
455 { 455 {
456 if(isFill) 456 if(isFill)
457 { 457 {
458 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(gradientM); 458 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(gradientM);
459 } 459 }
460 else 460 else
461 { 461 {
462 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(gradientM); 462 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(gradientM);
463 } 463 }
464 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 464 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
465 } 465 }
466 } 466 }
467 }, 467 },
468 468
469 _setFlatMaterial: { 469 _setFlatMaterial: {
@@ -480,10 +480,13 @@ exports.ShapesController = Montage.create(CanvasController, {
480 } 480 }
481 481
482 if(!m || ((m.getName() === "Linear Gradient") || m.getName() === "Radial Gradient") ) 482 if(!m || ((m.getName() === "Linear Gradient") || m.getName() === "Radial Gradient") )
483 { 483 {
484 // Uber Material also supports solid colors, so don't change from Uber to Flat Material
485 if(m && (m.getName() === "Uber")) { return; }
486
484 flatM = Object.create(MaterialsModel.getMaterial("Flat")); 487 flatM = Object.create(MaterialsModel.getMaterial("Flat"));
485 if(flatM) 488 if(flatM)
486 { 489 {
487 if(isFill) 490 if(isFill)
488 { 491 {
489 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(flatM); 492 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(flatM);
@@ -492,10 +495,10 @@ exports.ShapesController = Montage.create(CanvasController, {
492 { 495 {
493 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(flatM); 496 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(flatM);
494 } 497 }
495 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 498 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
496 }
497 } 499 }
498 } 500 }
501 }
499 }, 502 },
500 503
501 setColor: { 504 setColor: {
@@ -605,14 +608,31 @@ exports.ShapesController = Montage.create(CanvasController, {
605 608
606 setStroke: { 609 setStroke: {
607 value: function(el, stroke, eventType, source) { 610 value: function(el, stroke, eventType, source) {
608 if(stroke.colorInfo) {
609 this.setColor(el, stroke.colorInfo, false);
610 }
611 if(stroke.shapeInfo) { 611 if(stroke.shapeInfo) {
612 this.setProperty(el, "strokeSize", stroke.shapeInfo.strokeSize + " " + stroke.shapeInfo.strokeUnits, eventType, source); 612 this.setProperty(el, "strokeSize", stroke.shapeInfo.strokeSize + " " + stroke.shapeInfo.strokeUnits, eventType, source);
613 } 613 }
614 var m;
614 if(stroke.webGLInfo) { 615 if(stroke.webGLInfo) {
615 this.setProperty(el, "strokeMaterial", stroke.webGLInfo.material); 616 m = stroke.webGLInfo.material;
617 this.setProperty(el, "strokeMaterial", m);
618 if((m === "Linear Gradient") || (m === "Radial Gradient")) {
619 // Just use the default gradient material values
620 return;
621 }
622 }
623 if(stroke.colorInfo) {
624 if(el.elementModel.shapeModel.useWebGl) {
625 m = el.elementModel.shapeModel.GLGeomObj.getStrokeMaterial().getName();
626 if( ((stroke.colorInfo.mode === "gradient") && (m !== "Linear Gradient") && (m !== "Radial Gradient")) ||
627 ((stroke.colorInfo.mode !== "gradient") && ((m === "Linear Gradient") || (m === "Radial Gradient"))))
628 {
629 return;
630 } else {
631 this.setColor(el, stroke.colorInfo, false);
632 }
633 } else {
634 this.setColor(el, stroke.colorInfo, false);
635 }
616 } 636 }
617 } 637 }
618 }, 638 },
@@ -646,11 +666,28 @@ exports.ShapesController = Montage.create(CanvasController, {
646 666
647 setFill: { 667 setFill: {
648 value: function(el, fill) { 668 value: function(el, fill) {
649 if(fill.colorInfo) { 669 var m;
650 this.setColor(el, fill.colorInfo, true);
651 }
652 if(fill.webGLInfo) { 670 if(fill.webGLInfo) {
653 this.setProperty(el, "fillMaterial", fill.webGLInfo.material); 671 m = fill.webGLInfo.material;
672 this.setProperty(el, "fillMaterial", m);
673 if((m === "Linear Gradient") || (m === "Radial Gradient")) {
674 // Just use the default gradient material values
675 return;
676 }
677 }
678 if(fill.colorInfo) {
679 if(el.elementModel.shapeModel.useWebGl) {
680 m = el.elementModel.shapeModel.GLGeomObj.getFillMaterial().getName();
681 if( ((fill.colorInfo.mode === "gradient") && (m !== "Linear Gradient") && (m !== "Radial Gradient")) ||
682 ((fill.colorInfo.mode !== "gradient") && ((m === "Linear Gradient") || (m === "Radial Gradient"))))
683 {
684 return;
685 } else {
686 this.setColor(el, fill.colorInfo, true);
687 }
688 } else {
689 this.setColor(el, fill.colorInfo, true);
690 }
654 } 691 }
655 } 692 }
656 }, 693 },