From d44f3196c925332dcaf45f7cf8c64e22a1994bb9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 4 Jun 2012 17:11:06 -0700 Subject: Fill and Ink-Bottle fixes. Signed-off-by: Nivesh Rajbhandari --- js/tools/FillTool.js | 32 +++++++++++++++++++------------- js/tools/InkBottleTool.js | 10 +++++----- 2 files changed, 24 insertions(+), 18 deletions(-) (limited to 'js/tools') diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 66dd9305..69807bc3 100755 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js @@ -73,22 +73,28 @@ exports.FillTool = Montage.create(ModifierToolBase, { this.isDrawing = true; if(this._canColor && this.application.ninja.selectedElements.length) { + var fillInfo = {}, + color; + if(this.options.useFillColor.checked) { + fillInfo.colorInfo = {}; + color = this.options.fill; + if(color && color.color) + { + fillInfo.colorInfo.mode = color.colorMode; + fillInfo.colorInfo.color = color.color; + } else { + fillInfo.colorInfo.mode = "nocolor"; + fillInfo.colorInfo.color = null; + } + } - var color = this.options.fill, - colorInfo; - if(color && color.color) - { - colorInfo = { mode:color.colorMode, - color:color.color - }; + if(this.options.useWebGL.checked) { + fillInfo.webGLInfo = {}; + fillInfo.webGLInfo.material = this.options.fillMaterial.value; } - else - { - colorInfo = { mode:"nocolor", - color:color.color - }; + if(fillInfo.colorInfo || fillInfo.webGLInfo) { + ElementsMediator.setFill(this.application.ninja.selectedElements, fillInfo, "Change", "fillTool"); } - ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); } } } diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js index 2c03d133..bb5d3ae2 100755 --- a/js/tools/InkBottleTool.js +++ b/js/tools/InkBottleTool.js @@ -87,18 +87,18 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, { if(this.options.useBorderWidth.checked || this.options.useBorderStyle.checked) { colorInfo.borderInfo = {}; if(this.options.useBorderWidth.checked) { - colorInfo.borderInfo.borderWidth = this.options._borderWidth.value; - colorInfo.borderInfo.borderUnits = this.options._borderWidth.units; + colorInfo.borderInfo.borderWidth = this.options.borderWidth.value; + colorInfo.borderInfo.borderUnits = this.options.borderWidth.units; } if(this.options.useBorderStyle.checked) { - colorInfo.borderInfo.borderStyle = this.options._borderStyle.value; + colorInfo.borderInfo.borderStyle = this.options.borderStyle.value; } } if(this.options.useStrokeSize.checked) { colorInfo.strokeInfo = {}; - colorInfo.strokeInfo.strokeSize = this.options._strokeSize.value; - colorInfo.strokeInfo.strokeUnits = this.options._strokeSize.units; + colorInfo.strokeInfo.strokeSize = this.options.strokeSize.value; + colorInfo.strokeInfo.strokeUnits = this.options.strokeSize.units; } ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, false, "Change", "inkBottleTool"); -- cgit v1.2.3 From 945fac7b1593260757b6f2864810ca9916d7d698 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 5 Jun 2012 11:36:03 -0700 Subject: Updated ink bottle tool to support color-chip's checkbox and undo/redo for strokes/borders. Signed-off-by: Nivesh Rajbhandari --- js/tools/InkBottleTool.js | 49 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'js/tools') diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js index bb5d3ae2..dff0b0fa 100755 --- a/js/tools/InkBottleTool.js +++ b/js/tools/InkBottleTool.js @@ -69,39 +69,46 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, { if(this._canColor && this.application.ninja.selectedElements.length) { - var color = this.options.stroke, - colorInfo; - if(color && color.color) - { - colorInfo = { mode:color.colorMode, - color:color.color - }; - } - else - { - colorInfo = { mode:"nocolor", - color:color.color - }; + var strokeInfo = {}, + color; + if(this.options.useStrokeColor.checked) { + strokeInfo.colorInfo = {}; + color = this.options.stroke; + if(color && color.color) + { + strokeInfo.colorInfo.mode = color.colorMode; + strokeInfo.colorInfo.color = color.color; + } else { + strokeInfo.colorInfo.mode = "nocolor"; + strokeInfo.colorInfo.color = null; + } } if(this.options.useBorderWidth.checked || this.options.useBorderStyle.checked) { - colorInfo.borderInfo = {}; + strokeInfo.borderInfo = {}; if(this.options.useBorderWidth.checked) { - colorInfo.borderInfo.borderWidth = this.options.borderWidth.value; - colorInfo.borderInfo.borderUnits = this.options.borderWidth.units; + strokeInfo.borderInfo.borderWidth = this.options.borderWidth.value; + strokeInfo.borderInfo.borderUnits = this.options.borderWidth.units; } if(this.options.useBorderStyle.checked) { - colorInfo.borderInfo.borderStyle = this.options.borderStyle.value; + strokeInfo.borderInfo.borderStyle = this.options.borderStyle.value; } } if(this.options.useStrokeSize.checked) { - colorInfo.strokeInfo = {}; - colorInfo.strokeInfo.strokeSize = this.options.strokeSize.value; - colorInfo.strokeInfo.strokeUnits = this.options.strokeSize.units; + strokeInfo.shapeInfo = {}; + strokeInfo.shapeInfo.strokeSize = this.options.strokeSize.value; + strokeInfo.shapeInfo.strokeUnits = this.options.strokeSize.units; + } + + if(this.options.useWebGL.checked) { + strokeInfo.webGLInfo = {}; + strokeInfo.webGLInfo.material = this.options.strokeMaterial.value; } - ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, false, "Change", "inkBottleTool"); + if(strokeInfo.colorInfo || strokeInfo.borderInfo || strokeInfo.shapeInfo || strokeInfo.webGLInfo) { + ElementsMediator.setStroke(this.application.ninja.selectedElements, strokeInfo, "Change", "inkBottleTool"); + } } } } -- cgit v1.2.3