Prevented single point polys and polylines from being created, fixes Issue 104
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@705 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -855,11 +855,9 @@ function BatchCommand(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var svgCanvasToString = function() {
|
var svgCanvasToString = function() {
|
||||||
// remove unused gradients
|
|
||||||
removeUnusedGrads();
|
removeUnusedGrads();
|
||||||
|
canvas.clearPoly();
|
||||||
var output = svgToString(svgzoom, 0);
|
var output = svgToString(svgzoom, 0);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2198,7 +2196,8 @@ function BatchCommand(text) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
case "path":
|
case "path":
|
||||||
keep = true;
|
var coordnum = element.getAttribute('points').split(',').length - 1;
|
||||||
|
keep = coordnum > 1;
|
||||||
break;
|
break;
|
||||||
case "line":
|
case "line":
|
||||||
keep = (element.getAttribute('x1') != element.getAttribute('x2') ||
|
keep = (element.getAttribute('x1') != element.getAttribute('x2') ||
|
||||||
@@ -2347,10 +2346,11 @@ function BatchCommand(text) {
|
|||||||
// otherwise, close the poly
|
// otherwise, close the poly
|
||||||
if (i == 0 && current_poly_pts.length >= 6) {
|
if (i == 0 && current_poly_pts.length >= 6) {
|
||||||
poly.setAttribute("d", d_attr + "z");
|
poly.setAttribute("d", d_attr + "z");
|
||||||
|
} else if(current_poly_pts.length < 3) {
|
||||||
|
keep = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAllPointGripsFromPoly();
|
removeAllPointGripsFromPoly();
|
||||||
|
|
||||||
// this will signal to commit the poly
|
// this will signal to commit the poly
|
||||||
element = poly;
|
element = poly;
|
||||||
current_poly_pts = [];
|
current_poly_pts = [];
|
||||||
@@ -2883,6 +2883,10 @@ function BatchCommand(text) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.clearPoly = function() {
|
this.clearPoly = function() {
|
||||||
|
if(current_poly_pts.length > 0) {
|
||||||
|
var elem = svgdoc.getElementById(getId());
|
||||||
|
if(elem) elem.parentNode.removeChild(elem);
|
||||||
|
}
|
||||||
removeAllPointGripsFromPoly();
|
removeAllPointGripsFromPoly();
|
||||||
current_poly = null;
|
current_poly = null;
|
||||||
current_poly_pts = [];
|
current_poly_pts = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user