aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
authorArmen Kesablyan2012-02-07 16:51:14 -0800
committerArmen Kesablyan2012-02-07 16:51:14 -0800
commit8110e01dc5093ac6baf621103dcaa5f769e5be92 (patch)
treeecf339e3097b6ba25d81cbe44d913ee67591bf4b /js/controllers/elements/shapes-controller.js
parent5f506542d28e12b707c3bfa41b53383519838477 (diff)
parent668510892537eaaeb2e11520831d87b44b2489b7 (diff)
downloadninja-8110e01dc5093ac6baf621103dcaa5f769e5be92.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rw-r--r--js/controllers/elements/shapes-controller.js58
1 files changed, 50 insertions, 8 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index d34644a7..5efbccd0 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -24,6 +24,26 @@ exports.ShapesController = Montage.create(CanvasController, {
24 el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100); 24 el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100);
25 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 25 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
26 break; 26 break;
27 case "tlRadius":
28 this.setShapeProperty(el, "tlRadius", value);
29 el.elementModel.shapeModel.GLGeomObj.setTLRadius(val);
30 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
31 break;
32 case "trRadius":
33 this.setShapeProperty(el, "trRadius", value);
34 el.elementModel.shapeModel.GLGeomObj.setTRRadius(val);
35 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
36 break;
37 case "blRadius":
38 this.setShapeProperty(el, "blRadius", value);
39 el.elementModel.shapeModel.GLGeomObj.setBLRadius(val);
40 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
41 break;
42 case "brRadius":
43 this.setShapeProperty(el, "brRadius", value);
44 el.elementModel.shapeModel.GLGeomObj.setBRRadius(val);
45 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
46 break;
27 case "width": 47 case "width":
28 el.elementModel.shapeModel.GLGeomObj.setWidth(val); 48 el.elementModel.shapeModel.GLGeomObj.setWidth(val);
29 CanvasController.setProperty(el, p, value); 49 CanvasController.setProperty(el, p, value);
@@ -48,6 +68,14 @@ exports.ShapesController = Montage.create(CanvasController, {
48 switch(p) { 68 switch(p) {
49 case "strokeSize": 69 case "strokeSize":
50 case "innerRadius": 70 case "innerRadius":
71 case "tlRadius":
72 case "trRadius":
73 case "blRadius":
74 case "brRadius":
75 case "strokeMaterial":
76 case "fillMaterial":
77 case "border":
78 case "background":
51 return this.getShapeProperty(el, p); 79 return this.getShapeProperty(el, p);
52 default: 80 default:
53 return CanvasController.getProperty(el, p); 81 return CanvasController.getProperty(el, p);
@@ -154,30 +182,44 @@ exports.ShapesController = Montage.create(CanvasController, {
154 // Routines to get/set color properties 182 // Routines to get/set color properties
155 getColor: { 183 getColor: {
156 value: function(el, isFill) { 184 value: function(el, isFill) {
185 var color,
186 css;
157 if(isFill) 187 if(isFill)
158 { 188 {
159 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");
160 } 194 }
161 else 195 else
162 { 196 {
163 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");
164 } 202 }
203
204 css = this.application.ninja.colorController.colorModel.webGlToCss(color);
205 return this.application.ninja.colorController.getColorObjFromCss(css);
165 } 206 }
166 }, 207 },
167 208
168 setColor: { 209 setColor: {
169 value: function(el, color, isFill) { 210 value: function(el, color, isFill) {
170 // TODO - Format color for webGL before setting 211 var webGl = color.webGlColor || color.color.webGlColor;
171 color = color.webGlColor;
172 if(isFill) 212 if(isFill)
173 { 213 {
174 el.elementModel.shapeModel.GLGeomObj.setFillColor(color); 214 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
175 this.setShapeProperty(el, "fill", color); 215 this.setShapeProperty(el, "fill", webGl);
216 this.setShapeProperty(el, "background", color);
176 } 217 }
177 else 218 else
178 { 219 {
179 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); 220 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
180 this.setShapeProperty(el, "stroke", color); 221 this.setShapeProperty(el, "stroke", webGl);
222 this.setShapeProperty(el, "border", color);
181 } 223 }
182 el.elementModel.shapeModel.GLWorld.render(); 224 el.elementModel.shapeModel.GLWorld.render();
183 } 225 }