aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-23 10:38:51 -0800
committerJose Antonio Marquez2012-02-23 10:38:51 -0800
commitd764428023d87446fbbb153d8e04a23b900d71d5 (patch)
tree2581815db5567b52d4c59663ea9e37d6df057ca3 /js/controllers
parent3e1be6d4d4f0d3a2474af7d915954f9b6464fe2e (diff)
parentcc295dd0fb873505eed01c232bd987cf6e2dcdd9 (diff)
downloadninja-d764428023d87446fbbb153d8e04a23b900d71d5.tar.gz
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/color-controller.js14
-rwxr-xr-xjs/controllers/elements/element-controller.js13
-rwxr-xr-xjs/controllers/elements/image-controller.js2
-rwxr-xr-xjs/controllers/elements/shapes-controller.js12
-rwxr-xr-xjs/controllers/elements/stage-controller.js2
5 files changed, 40 insertions, 3 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js
index e3b15f1c..a6e41dd3 100755
--- a/js/controllers/color-controller.js
+++ b/js/controllers/color-controller.js
@@ -322,7 +322,19 @@ exports.ColorController = Montage.create(Component, {
322 //Simple solid color 322 //Simple solid color
323 color = this.parseCssToColor(css); 323 color = this.parseCssToColor(css);
324 } 324 }
325 //Returning color object (or null if none) 325 // TODO - Hack for inconsistent color object -- some workflows set color.color and some color.value
326 if(color)
327 {
328 if(color.value && !color.color)
329 {
330 color.color = color.value;
331 }
332 else if(color.color && !color.value)
333 {
334 color.value = color.color;
335 }
336 }
337 //Returning color object (or null if none)
326 return color; 338 return color;
327 } 339 }
328 }, 340 },
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index ac14def4..46e82ace 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -118,6 +118,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
118 } 118 }
119 else 119 else
120 { 120 {
121 // TODO - Need to update border style and width also
121 el.elementModel.stroke = colorObj; 122 el.elementModel.stroke = colorObj;
122 } 123 }
123 124
@@ -162,10 +163,22 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
162 case 'gradient': 163 case 'gradient':
163 this.setProperty(el, "border-image", color.color.css); 164 this.setProperty(el, "border-image", color.color.css);
164 this.setProperty(el, "border-color", "none"); 165 this.setProperty(el, "border-color", "none");
166 if(color.borderInfo)
167 {
168 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
169 color.borderInfo.borderUnits);
170 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
171 }
165 break; 172 break;
166 default: 173 default:
167 this.setProperty(el, "border-image", "none"); 174 this.setProperty(el, "border-image", "none");
168 this.setProperty(el, "border-color", color.color.css); 175 this.setProperty(el, "border-color", color.color.css);
176 if(color.borderInfo)
177 {
178 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
179 color.borderInfo.borderUnits);
180 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
181 }
169 } 182 }
170 } 183 }
171 el.elementModel.stroke = color; 184 el.elementModel.stroke = color;
diff --git a/js/controllers/elements/image-controller.js b/js/controllers/elements/image-controller.js
index 5abce13e..25ca8da6 100755
--- a/js/controllers/elements/image-controller.js
+++ b/js/controllers/elements/image-controller.js
@@ -19,7 +19,7 @@ exports.ImageController = Montage.create(ElementController, {
19 return el.getAttribute(prop); 19 return el.getAttribute(prop);
20 break; 20 break;
21 default: 21 default:
22 return ElementController.getProperty(el, prop); 22 return ElementController.getProperty(el, prop, true);
23 } 23 }
24 } 24 }
25 }, 25 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 5ced8820..a4c31c3e 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -230,6 +230,10 @@ exports.ShapesController = Montage.create(CanvasController, {
230 setColor: { 230 setColor: {
231 value: function(el, color, isFill) { 231 value: function(el, color, isFill) {
232 var webGl = color.webGlColor || color.color.webGlColor; 232 var webGl = color.webGlColor || color.color.webGlColor;
233 if(!webGl)
234 {
235 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
236 }
233 if(isFill) 237 if(isFill)
234 { 238 {
235 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 239 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
@@ -241,6 +245,14 @@ exports.ShapesController = Montage.create(CanvasController, {
241 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 245 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
242 this.setShapeProperty(el, "stroke", webGl); 246 this.setShapeProperty(el, "stroke", webGl);
243 this.setShapeProperty(el, "border", color); 247 this.setShapeProperty(el, "border", color);
248 if(color.strokeInfo)
249 {
250 var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize,
251 color.strokeInfo.strokeUnits);
252 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth);
253 this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " "
254 + color.strokeInfo.strokeUnits);
255 }
244 } 256 }
245 el.elementModel.shapeModel.GLWorld.render(); 257 el.elementModel.shapeModel.GLWorld.render();
246 } 258 }
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js
index a8546662..abad3736 100755
--- a/js/controllers/elements/stage-controller.js
+++ b/js/controllers/elements/stage-controller.js
@@ -76,7 +76,7 @@ exports.StageController = Montage.create(ElementController, {
76 value: function(el, p) { 76 value: function(el, p) {
77 switch(p) { 77 switch(p) {
78 case "background" : 78 case "background" :
79 return el.elementModel.stageBackground.style.getProperty(p); 79 return this.application.ninja.colorController.getColorObjFromCss(el.elementModel.stageBackground.style.getProperty(p));
80 case "border": 80 case "border":
81 return el.elementModel.stageView.style.getProperty(p); 81 return el.elementModel.stageView.style.getProperty(p);
82 case "height": 82 case "height":