Fixed issue 154: Cannot set Text stroke to 0 after it has been changed to non-zero

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@521 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2009-09-01 19:52:34 +00:00
parent 3557a0a94b
commit 4225c9e318
2 changed files with 16 additions and 4 deletions

View File

@@ -261,7 +261,13 @@ function svg_edit_setup() {
}
var changeStrokeWidth = function(ctl) {
svgCanvas.setStrokeWidth(ctl.value);
var val = ctl.value;
if(val == 0 && selectedElement && $.inArray(selectedElement.nodeName, ['line', 'polyline']) != -1) {
console.log('1');
val = 1;
ctl.value = 1;
}
svgCanvas.setStrokeWidth(val);
}
var changeRotationAngle = function(ctl) {
@@ -909,7 +915,7 @@ function svg_edit_setup() {
});
$('#rect_rx').SpinButton({ min: 0, max: 1000, step: 1, callback: changeRectRadius });
$('#stroke_width').SpinButton({ min: 1, max: 99, step: 1, callback: changeStrokeWidth });
$('#stroke_width').SpinButton({ min: 0, max: 99, step: 1, callback: changeStrokeWidth });
$('#angle').SpinButton({ min: -180, max: 180, step: 5, callback: changeRotationAngle });
svgCanvas.setCustomHandlers = function(opts) {

View File

@@ -1251,6 +1251,7 @@ function SvgCanvas(c)
start_x = x;
start_y = y;
d_attr = x + "," + y + " ";
var stroke_w = cur_shape.stroke_width == 0?1:cur_shape.stroke_width;
addSvgElementFromJson({
"element": "polyline",
"attr": {
@@ -1258,7 +1259,7 @@ function SvgCanvas(c)
"id": getNextId(),
"fill": "none",
"stroke": cur_shape.stroke,
"stroke-width": cur_shape.stroke_width,
"stroke-width": stroke_w,
"stroke-dasharray": cur_shape.stroke_style,
"stroke-opacity": cur_shape.stroke_opacity,
"stroke-linecap": "round",
@@ -1298,6 +1299,8 @@ function SvgCanvas(c)
break;
case "line":
started = true;
var stroke_w = cur_shape.stroke_width == 0?1:cur_shape.stroke_width;
console.log(stroke_w);
addSvgElementFromJson({
"element": "line",
"attr": {
@@ -1307,7 +1310,7 @@ function SvgCanvas(c)
"y2": y,
"id": getNextId(),
"stroke": cur_shape.stroke,
"stroke-width": cur_shape.stroke_width,
"stroke-width": stroke_w,
"stroke-dasharray": cur_shape.stroke_style,
"stroke-opacity": cur_shape.stroke_opacity,
"fill": "none",
@@ -2487,6 +2490,9 @@ function SvgCanvas(c)
};
this.setStrokeWidth = function(val) {
if(val == 0 && $.inArray(current_mode, ['line', 'path']) == -1) {
canvas.setStrokeWidth(1);
}
cur_properties.stroke_width = val;
this.changeSelectedAttribute("stroke-width", val);
};