aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-07 15:31:20 -0800
committerNivesh Rajbhandari2012-03-07 15:31:20 -0800
commitb6288e1ffe4ffe29a595bb1e146feb388503e2c4 (patch)
tree5b1e681f2602dfe79715a75404d907aaeb2ae9d5 /js/controllers
parent5bef5c5f2f7ee45d4c619c65ab8e9307c30420b5 (diff)
downloadninja-b6288e1ffe4ffe29a595bb1e146feb388503e2c4.tar.gz
gradient support for canvas-2d shapes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index b6d97b14..d72d9c14 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -261,28 +261,37 @@ exports.ShapesController = Montage.create(CanvasController, {
261 261
262 _setGradientMaterial: { 262 _setGradientMaterial: {
263 value: function(el, gradientMode, isFill) { 263 value: function(el, gradientMode, isFill) {
264 var m = "LinearGradientMaterial"; 264 var m = "LinearGradientMaterial",
265 fm;
265 if(gradientMode === "radial") 266 if(gradientMode === "radial")
266 { 267 {
267 m = "RadialGradientMaterial"; 268 m = "RadialGradientMaterial";
268 } 269 }
269 270
270 if(el.elementModel.shapeModel.fillMaterial.getName() !== m) 271 if(isFill)
271 { 272 {
272 var fm = Object.create(MaterialsModel.getMaterial(m)); 273 if(el.elementModel.shapeModel.fillMaterial.getName() !== m)
273 if(fm)
274 { 274 {
275 if(isFill) 275 fm = Object.create(MaterialsModel.getMaterial(m));
276 if(fm)
276 { 277 {
277 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); 278 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
278 el.elementModel.shapeModel.fillMaterial = fm; 279 el.elementModel.shapeModel.fillMaterial = fm;
280 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
279 } 281 }
280 else 282 }
283 }
284 else
285 {
286 if(el.elementModel.shapeModel.strokeMaterial.getName() !== m)
287 {
288 fm = Object.create(MaterialsModel.getMaterial(m));
289 if(fm)
281 { 290 {
282 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(fm); 291 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(fm);
283 el.elementModel.shapeModel.strokeMaterial = fm; 292 el.elementModel.shapeModel.strokeMaterial = fm;
293 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
284 } 294 }
285 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
286 } 295 }
287 } 296 }
288 } 297 }