aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rw-r--r--js/controllers/elements/shapes-controller.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 92353f28..1717db94 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -48,6 +48,8 @@ exports.ShapesController = Montage.create(CanvasController, {
48 switch(p) { 48 switch(p) {
49 case "strokeSize": 49 case "strokeSize":
50 case "innerRadius": 50 case "innerRadius":
51 case "border":
52 case "background":
51 return this.getShapeProperty(el, p); 53 return this.getShapeProperty(el, p);
52 default: 54 default:
53 return CanvasController.getProperty(el, p); 55 return CanvasController.getProperty(el, p);
@@ -154,30 +156,44 @@ exports.ShapesController = Montage.create(CanvasController, {
154 // Routines to get/set color properties 156 // Routines to get/set color properties
155 getColor: { 157 getColor: {
156 value: function(el, isFill) { 158 value: function(el, isFill) {
159 var color,
160 css;
157 if(isFill) 161 if(isFill)
158 { 162 {
159 return this.getShapeProperty(el, "fill"); 163 if(el.elementModel.shapeModel.background)
164 {
165 return el.elementModel.shapeModel.background;
166 }
167 color = this.getShapeProperty(el, "fill");
160 } 168 }
161 else 169 else
162 { 170 {
163 return this.getShapeProperty(el, "stroke"); 171 if(el.elementModel.shapeModel.border)
172 {
173 return el.elementModel.shapeModel.border;
174 }
175 color = this.getShapeProperty(el, "stroke");
164 } 176 }
177
178 css = this.application.ninja.colorController.colorModel.webGlToCss(color);
179 return this.application.ninja.colorController.getColorObjFromCss(css);
165 } 180 }
166 }, 181 },
167 182
168 setColor: { 183 setColor: {
169 value: function(el, color, isFill) { 184 value: function(el, color, isFill) {
170 // TODO - Format color for webGL before setting 185 var webGl = color.webGlColor || color.color.webGlColor;
171 color = color.webGlColor || color.color.webGlColor;
172 if(isFill) 186 if(isFill)
173 { 187 {
174 el.elementModel.shapeModel.GLGeomObj.setFillColor(color); 188 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
175 this.setShapeProperty(el, "fill", color); 189 this.setShapeProperty(el, "fill", webGl);
190 this.setShapeProperty(el, "background", color);
176 } 191 }
177 else 192 else
178 { 193 {
179 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); 194 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
180 this.setShapeProperty(el, "stroke", color); 195 this.setShapeProperty(el, "stroke", webGl);
196 this.setShapeProperty(el, "border", color);
181 } 197 }
182 el.elementModel.shapeModel.GLWorld.render(); 198 el.elementModel.shapeModel.GLWorld.render();
183 } 199 }