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:
@@ -261,7 +261,13 @@ function svg_edit_setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var changeStrokeWidth = function(ctl) {
|
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) {
|
var changeRotationAngle = function(ctl) {
|
||||||
@@ -909,7 +915,7 @@ function svg_edit_setup() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#rect_rx').SpinButton({ min: 0, max: 1000, step: 1, callback: changeRectRadius });
|
$('#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 });
|
$('#angle').SpinButton({ min: -180, max: 180, step: 5, callback: changeRotationAngle });
|
||||||
|
|
||||||
svgCanvas.setCustomHandlers = function(opts) {
|
svgCanvas.setCustomHandlers = function(opts) {
|
||||||
|
|||||||
@@ -1251,6 +1251,7 @@ function SvgCanvas(c)
|
|||||||
start_x = x;
|
start_x = x;
|
||||||
start_y = y;
|
start_y = y;
|
||||||
d_attr = x + "," + y + " ";
|
d_attr = x + "," + y + " ";
|
||||||
|
var stroke_w = cur_shape.stroke_width == 0?1:cur_shape.stroke_width;
|
||||||
addSvgElementFromJson({
|
addSvgElementFromJson({
|
||||||
"element": "polyline",
|
"element": "polyline",
|
||||||
"attr": {
|
"attr": {
|
||||||
@@ -1258,7 +1259,7 @@ function SvgCanvas(c)
|
|||||||
"id": getNextId(),
|
"id": getNextId(),
|
||||||
"fill": "none",
|
"fill": "none",
|
||||||
"stroke": cur_shape.stroke,
|
"stroke": cur_shape.stroke,
|
||||||
"stroke-width": cur_shape.stroke_width,
|
"stroke-width": stroke_w,
|
||||||
"stroke-dasharray": cur_shape.stroke_style,
|
"stroke-dasharray": cur_shape.stroke_style,
|
||||||
"stroke-opacity": cur_shape.stroke_opacity,
|
"stroke-opacity": cur_shape.stroke_opacity,
|
||||||
"stroke-linecap": "round",
|
"stroke-linecap": "round",
|
||||||
@@ -1298,6 +1299,8 @@ function SvgCanvas(c)
|
|||||||
break;
|
break;
|
||||||
case "line":
|
case "line":
|
||||||
started = true;
|
started = true;
|
||||||
|
var stroke_w = cur_shape.stroke_width == 0?1:cur_shape.stroke_width;
|
||||||
|
console.log(stroke_w);
|
||||||
addSvgElementFromJson({
|
addSvgElementFromJson({
|
||||||
"element": "line",
|
"element": "line",
|
||||||
"attr": {
|
"attr": {
|
||||||
@@ -1307,7 +1310,7 @@ function SvgCanvas(c)
|
|||||||
"y2": y,
|
"y2": y,
|
||||||
"id": getNextId(),
|
"id": getNextId(),
|
||||||
"stroke": cur_shape.stroke,
|
"stroke": cur_shape.stroke,
|
||||||
"stroke-width": cur_shape.stroke_width,
|
"stroke-width": stroke_w,
|
||||||
"stroke-dasharray": cur_shape.stroke_style,
|
"stroke-dasharray": cur_shape.stroke_style,
|
||||||
"stroke-opacity": cur_shape.stroke_opacity,
|
"stroke-opacity": cur_shape.stroke_opacity,
|
||||||
"fill": "none",
|
"fill": "none",
|
||||||
@@ -2487,6 +2490,9 @@ function SvgCanvas(c)
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.setStrokeWidth = function(val) {
|
this.setStrokeWidth = function(val) {
|
||||||
|
if(val == 0 && $.inArray(current_mode, ['line', 'path']) == -1) {
|
||||||
|
canvas.setStrokeWidth(1);
|
||||||
|
}
|
||||||
cur_properties.stroke_width = val;
|
cur_properties.stroke_width = val;
|
||||||
this.changeSelectedAttribute("stroke-width", val);
|
this.changeSelectedAttribute("stroke-width", val);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user