aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-07 11:42:46 -0800
committerNivesh Rajbhandari2012-03-07 11:42:46 -0800
commitfc567223aded95c35982b1d1239f6d28a957a199 (patch)
treede23741ef2fbf1c206d6b8544af3f1b4310171bd /js/controllers
parentf5b0162a9b148589f0ccc65a0332695ea6fd6be3 (diff)
downloadninja-fc567223aded95c35982b1d1239f6d28a957a199.tar.gz
Gradient support for canvas-2d rectangle.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 7079fc7f..b6d97b14 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -301,22 +301,25 @@ exports.ShapesController = Montage.create(CanvasController, {
301 el.elementModel.shapeModel.GLGeomObj.setFillColor(null); 301 el.elementModel.shapeModel.GLGeomObj.setFillColor(null);
302 this.setShapeProperty(el, "fill", null); 302 this.setShapeProperty(el, "fill", null);
303 this.setShapeProperty(el, "background", color); 303 this.setShapeProperty(el, "background", color);
304// el.elementModel.fill = null; 304 el.elementModel.fill = null;
305 return; 305 return;
306 case 'gradient': 306 case 'gradient':
307 this._setGradientMaterial(el, color.color.gradientMode, isFill); 307 if(el.elementModel.shapeModel.useWebGl)
308 {
309 this._setGradientMaterial(el, color.color.gradientMode, isFill);
310 }
308 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 311 el.elementModel.shapeModel.GLGeomObj.setFillColor({gradientMode:color.color.gradientMode, color:color.color.stops});
309 el.elementModel.shapeModel.GLWorld.render(); 312 el.elementModel.shapeModel.GLWorld.render();
310 this.setShapeProperty(el, "fill", color.color.css); 313 this.setShapeProperty(el, "fill", color.color.css);
311 this.setShapeProperty(el, "background", color); 314 this.setShapeProperty(el, "background", color);
312// el.elementModel.fill = color; 315 el.elementModel.fill = color;
313 break; 316 break;
314 default: 317 default:
315 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 318 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
316 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 319 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
317 this.setShapeProperty(el, "fill", webGl); 320 this.setShapeProperty(el, "fill", webGl);
318 this.setShapeProperty(el, "background", color); 321 this.setShapeProperty(el, "background", color);
319// el.elementModel.fill = color; 322 el.elementModel.fill = color;
320 } 323 }
321 } 324 }
322 } 325 }
@@ -339,22 +342,25 @@ exports.ShapesController = Montage.create(CanvasController, {
339 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(null); 342 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(null);
340 this.setShapeProperty(el, "stroke", null); 343 this.setShapeProperty(el, "stroke", null);
341 this.setShapeProperty(el, "border", color); 344 this.setShapeProperty(el, "border", color);
342// el.elementModel.fill = null; 345 el.elementModel.fill = null;
343 return; 346 return;
344 case 'gradient': 347 case 'gradient':
345 this._setGradientMaterial(el, color.color.gradientMode, isFill); 348 if(el.elementModel.shapeModel.useWebGl)
349 {
350 this._setGradientMaterial(el, color.color.gradientMode, isFill);
351 }
346 el.elementModel.shapeModel.GLGeomObj.setStrokeColor({gradientMode:color.color.gradientMode, color:color.color.stops}); 352 el.elementModel.shapeModel.GLGeomObj.setStrokeColor({gradientMode:color.color.gradientMode, color:color.color.stops});
347 el.elementModel.shapeModel.GLWorld.render(); 353 el.elementModel.shapeModel.GLWorld.render();
348 this.setShapeProperty(el, "stroke", color.color.css); 354 this.setShapeProperty(el, "stroke", color.color.css);
349 this.setShapeProperty(el, "border", color); 355 this.setShapeProperty(el, "border", color);
350// el.elementModel.fill = color; 356 el.elementModel.fill = color;
351 break; 357 break;
352 default: 358 default:
353 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color); 359 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
354 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 360 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
355 this.setShapeProperty(el, "stroke", webGl); 361 this.setShapeProperty(el, "stroke", webGl);
356 this.setShapeProperty(el, "border", color); 362 this.setShapeProperty(el, "border", color);
357// el.elementModel.fill = color; 363 el.elementModel.fill = color;
358 } 364 }
359 } 365 }
360 } 366 }