diff options
author | Valerio Virgillito | 2012-02-23 00:34:37 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-23 00:34:37 -0800 |
commit | 3675cac3993430490d9eef18157314d53ffa1a6a (patch) | |
tree | fb225a6d8fc3c983c96b1507483d628909dc8c1e /js/controllers/elements | |
parent | 2afef244a3f8124f8a049e504e9782c05904ce23 (diff) | |
parent | 3730bbc7cc5d5f07b3d788885475a8f9810b480e (diff) | |
download | ninja-3675cac3993430490d9eef18157314d53ffa1a6a.tar.gz |
Merge pull request #60 from mqg734/WebGLMaterials
Integrating WebGL and canvas-2d drawing fixes. Fixed Materials Editor Popup to work with latest Montage framework. Also adding back WebGL materials.
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 13 | ||||
-rwxr-xr-x | js/controllers/elements/image-controller.js | 2 | ||||
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 12 | ||||
-rwxr-xr-x | js/controllers/elements/stage-controller.js | 2 |
4 files changed, 27 insertions, 2 deletions
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 15a18a51..e0bff70c 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -250,6 +250,10 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
250 | setColor: { | 250 | setColor: { |
251 | value: function(el, color, isFill) { | 251 | value: function(el, color, isFill) { |
252 | var webGl = color.webGlColor || color.color.webGlColor; | 252 | var webGl = color.webGlColor || color.color.webGlColor; |
253 | if(!webGl) | ||
254 | { | ||
255 | webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); | ||
256 | } | ||
253 | if(isFill) | 257 | if(isFill) |
254 | { | 258 | { |
255 | el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); | 259 | el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); |
@@ -261,6 +265,14 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
261 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); | 265 | el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); |
262 | this.setShapeProperty(el, "stroke", webGl); | 266 | this.setShapeProperty(el, "stroke", webGl); |
263 | this.setShapeProperty(el, "border", color); | 267 | this.setShapeProperty(el, "border", color); |
268 | if(color.strokeInfo) | ||
269 | { | ||
270 | var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize, | ||
271 | color.strokeInfo.strokeUnits); | ||
272 | el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth); | ||
273 | this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " | ||
274 | + color.strokeInfo.strokeUnits); | ||
275 | } | ||
264 | } | 276 | } |
265 | el.elementModel.shapeModel.GLWorld.render(); | 277 | el.elementModel.shapeModel.GLWorld.render(); |
266 | } | 278 | } |
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": |