Fix Issue 25: un-normalize path segments that webkit has munged

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@141 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-06-17 18:05:45 +00:00
parent 543308a82d
commit 15a46f5551
1 changed files with 12 additions and 2 deletions

View File

@ -443,10 +443,20 @@ function SvgCanvas(c)
case "path":
// extract the x,y from the path, adjust it and write back the new path
var M = selected.pathSegList.getItem(0);
var newd = "M" + (M.x+dx) + "," + (M.y+dy);
var curx = M.x, cury = M.y;
var newd = "M" + (curx+dx) + "," + (cury+dy);
for (var i = 1; i < selected.pathSegList.numberOfItems; ++i) {
var l = selected.pathSegList.getItem(i);
newd += " l" + l.x + "," + l.y;
var x = l.x, y = l.y;
// webkit browsers normalize things and this becomes an absolute
// line segment! we need to turn this back into a rel line segment
if (l.pathSegType == 4) {
x -= curx;
y -= cury;
curx += x;
cury += y;
}
newd += " l" + x + "," + y;
}
selected.setAttributeNS(null, "d", newd);
break;