aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-06 14:36:51 -0800
committerValerio Virgillito2012-02-06 14:36:51 -0800
commit191898aaa63b357b5709b94cd38e15a258a9d95f (patch)
tree7fa44f2ec5042b942f37151bbfb67f875680f040 /js/controllers/elements/shapes-controller.js
parent08eafdff4ec25d34e2e76b386145a9fd122431dc (diff)
parent07e5839e0ec6da2eb71056ff18b90226af213eef (diff)
downloadninja-191898aaa63b357b5709b94cd38e15a258a9d95f.tar.gz
Merge branch 'master' into components
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rw-r--r--js/controllers/elements/shapes-controller.js34
1 files changed, 24 insertions, 10 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index c5f22138..5efbccd0 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -66,8 +66,6 @@ exports.ShapesController = Montage.create(CanvasController, {
66 getProperty: { 66 getProperty: {
67 value: function(el, p) { 67 value: function(el, p) {
68 switch(p) { 68 switch(p) {
69 case "stroke":
70 case "fill":
71 case "strokeSize": 69 case "strokeSize":
72 case "innerRadius": 70 case "innerRadius":
73 case "tlRadius": 71 case "tlRadius":
@@ -76,6 +74,8 @@ exports.ShapesController = Montage.create(CanvasController, {
76 case "brRadius": 74 case "brRadius":
77 case "strokeMaterial": 75 case "strokeMaterial":
78 case "fillMaterial": 76 case "fillMaterial":
77 case "border":
78 case "background":
79 return this.getShapeProperty(el, p); 79 return this.getShapeProperty(el, p);
80 default: 80 default:
81 return CanvasController.getProperty(el, p); 81 return CanvasController.getProperty(el, p);
@@ -182,30 +182,44 @@ exports.ShapesController = Montage.create(CanvasController, {
182 // Routines to get/set color properties 182 // Routines to get/set color properties
183 getColor: { 183 getColor: {
184 value: function(el, isFill) { 184 value: function(el, isFill) {
185 var color,
186 css;
185 if(isFill) 187 if(isFill)
186 { 188 {
187 return this.getShapeProperty(el, "fill"); 189 if(el.elementModel.shapeModel.background)
190 {
191 return el.elementModel.shapeModel.background;
192 }
193 color = this.getShapeProperty(el, "fill");
188 } 194 }
189 else 195 else
190 { 196 {
191 return this.getShapeProperty(el, "stroke"); 197 if(el.elementModel.shapeModel.border)
198 {
199 return el.elementModel.shapeModel.border;
200 }
201 color = this.getShapeProperty(el, "stroke");
192 } 202 }
203
204 css = this.application.ninja.colorController.colorModel.webGlToCss(color);
205 return this.application.ninja.colorController.getColorObjFromCss(css);
193 } 206 }
194 }, 207 },
195 208
196 setColor: { 209 setColor: {
197 value: function(el, color, isFill) { 210 value: function(el, color, isFill) {
198 // TODO - Format color for webGL before setting 211 var webGl = color.webGlColor || color.color.webGlColor;
199 color = color.webGlColor;
200 if(isFill) 212 if(isFill)
201 { 213 {
202 el.elementModel.shapeModel.GLGeomObj.setFillColor(color); 214 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
203 this.setShapeProperty(el, "fill", color); 215 this.setShapeProperty(el, "fill", webGl);
216 this.setShapeProperty(el, "background", color);
204 } 217 }
205 else 218 else
206 { 219 {
207 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); 220 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
208 this.setShapeProperty(el, "stroke", color); 221 this.setShapeProperty(el, "stroke", webGl);
222 this.setShapeProperty(el, "border", color);
209 } 223 }
210 el.elementModel.shapeModel.GLWorld.render(); 224 el.elementModel.shapeModel.GLWorld.render();
211 } 225 }