From a0daa3668883c8c35ce277b60509a3a3dcf303b2 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 24 Apr 2012 11:42:42 -0700 Subject: Allow users to toggle application of stroke and border settings when using the ink bottle tool. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 16 ++++++++++++---- js/controllers/elements/shapes-controller.js | 20 +++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 35a543ac..452d09f1 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -152,16 +152,24 @@ exports.ElementController = Montage.create(Component, { this.setProperty(el, "border-image", color.color.css); this.setProperty(el, "border-color", "none"); if(color.borderInfo) { - this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); - this.setProperty(el, "border-style", color.borderInfo.borderStyle); + if(color.borderInfo.borderWidth) { + this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); + } + if(color.borderInfo.borderStyle) { + this.setProperty(el, "border-style", color.borderInfo.borderStyle); + } } break; default: this.setProperty(el, "border-image", "none"); this.setProperty(el, "border-color", color.color.css); if(color.borderInfo) { - this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); - this.setProperty(el, "border-style", color.borderInfo.borderStyle); + if(color.borderInfo.borderWidth) { + this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); + } + if(color.borderInfo.borderStyle) { + this.setProperty(el, "border-style", color.borderInfo.borderStyle); + } } } } diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index e9dde5fc..3ada5f82 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -20,8 +20,10 @@ exports.ShapesController = Montage.create(CanvasController, { color; switch(p) { case "strokeSize": - // TODO - For now, just handling px units. this.setShapeProperty(el, "strokeSize", value); + var strokeInfo = value.split(" "); + val = this.GetValueInPixels(strokeInfo[0], strokeInfo[1]); + // TODO - For now, just handle Line, Rectangle and Oval. Eventually, move this into each class's // setStrokeWidth code like SubPath and BrushStroke do. var geomType = el.elementModel.shapeModel.GLGeomObj.geomType(); @@ -527,16 +529,6 @@ exports.ShapesController = Montage.create(CanvasController, { } else { - // Support for ink-bottle tool - if(color.strokeInfo) - { - var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize, - color.strokeInfo.strokeUnits); - el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth); - this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " - + color.strokeInfo.strokeUnits); - } - if(mode) { switch (mode) { @@ -559,6 +551,12 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); } } + + // Support for ink-bottle tool + if(color.strokeInfo) + { + this.setProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " + color.strokeInfo.strokeUnits); + } } el.elementModel.shapeModel.GLWorld.render(); this.application.ninja.documentController.activeDocument.needsSave = true; -- cgit v1.2.3