Add suspendRedraw() around path resizing.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@385 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
c83d515fe9
commit
16f7caa078
|
@ -759,12 +759,15 @@ function SvgCanvas(c)
|
||||||
case "path":
|
case "path":
|
||||||
// extract the x,y from the path, adjust it and write back the new path
|
// extract the x,y from the path, adjust it and write back the new path
|
||||||
// but first, save the old path
|
// but first, save the old path
|
||||||
|
var handle = svgroot.suspendRedraw(1000);
|
||||||
changes["d"] = selected.getAttribute("d");
|
changes["d"] = selected.getAttribute("d");
|
||||||
var M = selected.pathSegList.getItem(0);
|
var M = selected.pathSegList.getItem(0);
|
||||||
var curx = M.x, cury = M.y;
|
var curx = M.x, cury = M.y;
|
||||||
var newd = "M" + remapx(curx) + "," + remapy(cury);
|
var newd = "M" + remapx(curx) + "," + remapy(cury);
|
||||||
var segList = selected.pathSegList;
|
var segList = selected.pathSegList;
|
||||||
var len = segList.numberOfItems;
|
var len = segList.numberOfItems;
|
||||||
|
// for all path segments in the path, we first turn them into relative path segments,
|
||||||
|
// then we remap the coordinates from the resize
|
||||||
for (var i = 1; i < len; ++i) {
|
for (var i = 1; i < len; ++i) {
|
||||||
var seg = segList.getItem(i);
|
var seg = segList.getItem(i);
|
||||||
// if these properties are not in the segment, set them to zero
|
// if these properties are not in the segment, set them to zero
|
||||||
|
@ -775,10 +778,6 @@ function SvgCanvas(c)
|
||||||
x2 = seg.x2 || 0,
|
x2 = seg.x2 || 0,
|
||||||
y2 = seg.y2 || 0;
|
y2 = seg.y2 || 0;
|
||||||
|
|
||||||
// This will let us drag/resize any path (currently we can only
|
|
||||||
// drag/resize paths that contain line segments)
|
|
||||||
// Webkit browsers normalize things and all relative segments becomes absolute
|
|
||||||
// We turn them back into relative segments. see https://bugs.webkit.org/show_bug.cgi?id=26487
|
|
||||||
var type = seg.pathSegType;
|
var type = seg.pathSegType;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1: // z,Z closepath (Z/z)
|
case 1: // z,Z closepath (Z/z)
|
||||||
|
@ -849,6 +848,7 @@ function SvgCanvas(c)
|
||||||
} // switch on path segment type
|
} // switch on path segment type
|
||||||
} // for each segment
|
} // for each segment
|
||||||
selected.setAttributeNS(null, "d", newd);
|
selected.setAttributeNS(null, "d", newd);
|
||||||
|
svgroot.unsuspendRedraw(handle);
|
||||||
break;
|
break;
|
||||||
case "line":
|
case "line":
|
||||||
changes["x1"] = selected.x1.baseVal.value;
|
changes["x1"] = selected.x1.baseVal.value;
|
||||||
|
|
Loading…
Reference in New Issue