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.js60
1 files changed, 24 insertions, 36 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index c5f22138..1717db94 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -24,26 +24,6 @@ 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;
47 case "width": 27 case "width":
48 el.elementModel.shapeModel.GLGeomObj.setWidth(val); 28 el.elementModel.shapeModel.GLGeomObj.setWidth(val);
49 CanvasController.setProperty(el, p, value); 29 CanvasController.setProperty(el, p, value);
@@ -66,16 +46,10 @@ exports.ShapesController = Montage.create(CanvasController, {
66 getProperty: { 46 getProperty: {
67 value: function(el, p) { 47 value: function(el, p) {
68 switch(p) { 48 switch(p) {
69 case "stroke":
70 case "fill":
71 case "strokeSize": 49 case "strokeSize":
72 case "innerRadius": 50 case "innerRadius":
73 case "tlRadius": 51 case "border":
74 case "trRadius": 52 case "background":
75 case "blRadius":
76 case "brRadius":
77 case "strokeMaterial":
78 case "fillMaterial":
79 return this.getShapeProperty(el, p); 53 return this.getShapeProperty(el, p);
80 default: 54 default:
81 return CanvasController.getProperty(el, p); 55 return CanvasController.getProperty(el, p);
@@ -182,30 +156,44 @@ exports.ShapesController = Montage.create(CanvasController, {
182 // Routines to get/set color properties 156 // Routines to get/set color properties
183 getColor: { 157 getColor: {
184 value: function(el, isFill) { 158 value: function(el, isFill) {
159 var color,
160 css;
185 if(isFill) 161 if(isFill)
186 { 162 {
187 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");
188 } 168 }
189 else 169 else
190 { 170 {
191 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");
192 } 176 }
177
178 css = this.application.ninja.colorController.colorModel.webGlToCss(color);
179 return this.application.ninja.colorController.getColorObjFromCss(css);
193 } 180 }
194 }, 181 },
195 182
196 setColor: { 183 setColor: {
197 value: function(el, color, isFill) { 184 value: function(el, color, isFill) {
198 // TODO - Format color for webGL before setting 185 var webGl = color.webGlColor || color.color.webGlColor;
199 color = color.webGlColor;
200 if(isFill) 186 if(isFill)
201 { 187 {
202 el.elementModel.shapeModel.GLGeomObj.setFillColor(color); 188 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
203 this.setShapeProperty(el, "fill", color); 189 this.setShapeProperty(el, "fill", webGl);
190 this.setShapeProperty(el, "background", color);
204 } 191 }
205 else 192 else
206 { 193 {
207 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); 194 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
208 this.setShapeProperty(el, "stroke", color); 195 this.setShapeProperty(el, "stroke", webGl);
196 this.setShapeProperty(el, "border", color);
209 } 197 }
210 el.elementModel.shapeModel.GLWorld.render(); 198 el.elementModel.shapeModel.GLWorld.render();
211 } 199 }