From 830b011d94d728882286d72e129f7405134957c7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 1 Feb 2012 17:05:07 -0800 Subject: Updated color code in the PI to go through element mediator. Signed-off-by: Nivesh Rajbhandari --- js/tools/LineTool.js | 4 ++++ js/tools/OvalTool.js | 8 ++++++++ js/tools/RectTool.js | 8 ++++++++ 3 files changed, 20 insertions(+) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 042ba0b2..a0d5a182 100644 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -225,6 +225,10 @@ exports.LineTool = Montage.create(ShapeTool, { canvas.elementModel.pi = "LinePi"; canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; canvas.elementModel.shapeModel.stroke = strokeColor; + if(strokeColor) + { + canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + } canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index e0f1f03f..2fa5411b 100644 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js @@ -75,6 +75,14 @@ exports.OvalTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; canvas.elementModel.shapeModel.stroke = strokeColor; canvas.elementModel.shapeModel.fill = fillColor; + if(strokeColor) + { + canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + } + if(fillColor) + { + canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill; + } canvas.elementModel.shapeModel.innerRadius = this.options.innerRadius.value + " " + this.options.innerRadius.units; diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index fbf1693e..94d80b53 100644 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -94,6 +94,14 @@ exports.RectTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; canvas.elementModel.shapeModel.stroke = strokeColor; canvas.elementModel.shapeModel.fill = fillColor; + if(strokeColor) + { + canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + } + if(fillColor) + { + canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill; + } canvas.elementModel.shapeModel.tlRadius = this.options.TLRadiusControl.value + " " + this.options.TLRadiusControl.units; canvas.elementModel.shapeModel.trRadius = this.options.TRRadiusControl.value + " " + this.options.TRRadiusControl.units; -- cgit v1.2.3 From 01efeff045e7196bab37fc60f7030969ad650d6c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 1 Feb 2012 21:14:17 -0800 Subject: Removed border special-casing from PI since the mediator now handles this generically. Updated mediator's set stroke routine to use the setColor routine. Signed-off-by: Nivesh Rajbhandari --- js/tools/FillTool.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'js/tools') diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 477966da..fabcec69 100644 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js @@ -54,10 +54,24 @@ exports.FillTool = Montage.create(ModifierToolBase, { value: function(event) { this.isDrawing = true; - if(this._canColor) + if(this._canColor && this.application.ninja.selectedElements.length) { - var color = this.application.ninja.colorController.colorToolbar.fill; - ElementsMediator.setColor(this.application.ninja.selectedElements, color, true, "Change", "fillTool"); + var color = this.application.ninja.colorController.colorToolbar.fill, + colorInfo; + if(color && color.color) + { + colorInfo = { mode:color.colorMode, + color:color.color + }; + ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); + } + else + { + colorInfo = { mode:"nocolor", + color:color.color + }; + ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); + } } } } -- cgit v1.2.3