From 4e17c0092041c4769eec60d26a129a58d897e7b7 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 20 Aug 2009 13:50:41 +0000 Subject: [PATCH] Fixed issue 86: Text should have different starting fill/stroke properties git-svn-id: http://svg-edit.googlecode.com/svn/trunk@417 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index d8449708..d8e0f0c5 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -468,6 +468,8 @@ function SvgCanvas(c) var current_opacity = 1; var current_stroke_opacity = 1; var current_fill_opacity = 1; + var current_text_fill = "#000000"; + var current_text_stroke_width = 0; var current_font_size = "12pt"; var current_font_family = "serif"; var freehand_min_x = null; @@ -1194,9 +1196,9 @@ function SvgCanvas(c) "x": x, "y": y, "id": getNextId(), - "fill": current_fill, + "fill": current_text_fill, "stroke": current_stroke, - "stroke-width": current_stroke_width, + "stroke-width": current_text_stroke_width, "stroke-dasharray": current_stroke_style, "stroke-opacity": current_stroke_opacity, "fill-opacity": current_fill_opacity, @@ -2011,7 +2013,12 @@ function SvgCanvas(c) }; this.setFillColor = function(val) { - current_fill = val; + if(selectedElements.length && selectedElements[0].nodeName == 'text') { + current_text_fill = val; + } else { + current_fill = val; + } + // take out any path/line elements when setting fill var elems = []; var i = selectedElements.length; @@ -2143,7 +2150,11 @@ function SvgCanvas(c) }; this.setStrokeWidth = function(val) { - current_stroke_width = val; + if(selectedElements.length && selectedElements[0].nodeName == 'text') { + current_text_stroke_width = val; + } else { + current_stroke_width = val; + } this.changeSelectedAttribute("stroke-width", val); };