diff options
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 0d6defe2..da4e6d1b 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -142,7 +142,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
142 | if(m) | 142 | if(m) |
143 | { | 143 | { |
144 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m); | 144 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(m); |
145 | color = this.getMaterialColor(m); | 145 | color = this.getMaterialColor(value); |
146 | if(color) | 146 | if(color) |
147 | { | 147 | { |
148 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); | 148 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); |
@@ -156,7 +156,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
156 | if(m) | 156 | if(m) |
157 | { | 157 | { |
158 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m); | 158 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(m); |
159 | color = this.getMaterialColor(m); | 159 | color = this.getMaterialColor(value); |
160 | if(color) | 160 | if(color) |
161 | { | 161 | { |
162 | el.elementModel.shapeModel.GLGeomObj.setFillColor(color); | 162 | el.elementModel.shapeModel.GLGeomObj.setFillColor(color); |
@@ -750,34 +750,14 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
750 | value: function(m) | 750 | value: function(m) |
751 | { | 751 | { |
752 | var css, | 752 | var css, |
753 | colorObj, | 753 | colorObj; |
754 | c, | 754 | if(m === "LinearGradientMaterial") |
755 | mName = m.getName(); | ||
756 | if(mName === "LinearGradientMaterial") | ||
757 | { | 755 | { |
758 | css = "-webkit-gradient(linear, left top, right top, from("; | 756 | css = "-webkit-gradient(linear, left top, right top, from(rgb(255, 0, 0)), color-stop(0.3, rgb(0, 255, 0)), color-stop(0.6, rgb(0, 0, 255)), to(rgb(0, 255, 255)))"; |
759 | c = this.webGlColorToCss(m, 1); | ||
760 | css += c.rgb + ")"; | ||
761 | c = this.webGlColorToCss(m, 2); | ||
762 | css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; | ||
763 | c = this.webGlColorToCss(m, 3); | ||
764 | css += ", color-stop(" + c.stop + ", " + c.rgb + ")"; | ||
765 | c = this.webGlColorToCss(m, 4); | ||
766 | css += ", to(" + c.rgb + "))"; | ||
767 | // console.log(css); | ||
768 | } | 757 | } |
769 | else if(mName === "RadialGradientMaterial") | 758 | else if(m === "RadialGradientMaterial") |
770 | { | 759 | { |
771 | css = "-webkit-radial-gradient(50% 50%, ellipse cover, "; | 760 | css = "-webkit-radial-gradient(50% 50%, ellipse cover, rgb(255, 0, 0) 0%, rgb(0, 255, 0) 30%, rgb(0, 0, 255) 60%, rgb(0, 255, 255) 100%)"; |
772 | c = this.webGlColorToCss(m, 1); | ||
773 | css += c.rgb + " " + c.stop*100 + "%"; | ||
774 | c = this.webGlColorToCss(m, 2); | ||
775 | css += c.rgb + " " + c.stop*100 + "%"; | ||
776 | c = this.webGlColorToCss(m, 3); | ||
777 | css += c.rgb + " " + c.stop*100 + "%"; | ||
778 | c = this.webGlColorToCss(m, 4); | ||
779 | css += c.rgb + " " + c.stop*100 + "%)"; | ||
780 | // console.log(css); | ||
781 | } | 761 | } |
782 | 762 | ||
783 | if(css) | 763 | if(css) |
@@ -791,18 +771,6 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
791 | 771 | ||
792 | return null; | 772 | return null; |
793 | } | 773 | } |
794 | }, | ||
795 | |||
796 | webGlColorToCss: { | ||
797 | value: function(m, index) | ||
798 | { | ||
799 | var color, rgba, cStop; | ||
800 | color = m["getColor" + index](); | ||
801 | rgba = 'rgba(' + color[0]*255 + ',' + color[1]*255 + ',' + color[2]*255 + ',' + color[3] + ')'; | ||
802 | cStop = m["getColorStop" + index](); | ||
803 | |||
804 | return {rgb:rgba, stop: cStop}; | ||
805 | } | ||
806 | } | 774 | } |
807 | 775 | ||
808 | }); | 776 | }); |