From 2f0a29c2cc9fd399e392abfd6770caffb99fdbb5 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 26 Jun 2012 10:41:20 -0700 Subject: Support pre-flighting of gradients for shape tools - rect, line, oval, brush and pen. Note that WebGL shapes are not supported yet. Signed-off-by: Nivesh Rajbhandari --- js/tools/ShapeTool.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'js/tools/ShapeTool.js') diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index 8d381711..6ff61546 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js @@ -209,7 +209,31 @@ exports.ShapeTool = Montage.create(DrawingTool, { return target; } - } + }, + + // We can draw on an existing canvas unless it has only a single shape object + setColor: { + value: function(stroke, fill, canvas, toolId) + { + if(stroke && stroke.color) + { + this.application.ninja.elementMediator.setColor([canvas], {mode:stroke.colorMode, color:stroke.color}, false, "Change", toolId); + } + else + { + this.application.ninja.elementMediator.setColor([canvas], {mode:"nocolor", color:null}, false, "Change", toolId); + } + + if(fill && fill.color) + { + this.application.ninja.elementMediator.setColor([canvas], {mode:fill.colorMode, color:fill.color}, true, "Change", toolId); + } + else + { + this.application.ninja.elementMediator.setColor([canvas], {mode:"nocolor", color:null}, true, "Change", toolId); + } + } + } }); -- cgit v1.2.3