diff --git a/editor/path.js b/editor/path.js index 75ad3c7e..ccdf5486 100644 --- a/editor/path.js +++ b/editor/path.js @@ -478,16 +478,12 @@ svgedit.path.Segment.prototype.update = function(full) { svgedit.path.Segment.prototype.move = function(dx, dy) { var cur_pts, item = this.item; - // fix for path tool dom breakage, amending item does bad things now, so we take a copy and use that. Can probably improve to just take a shallow copy of object - var cloneItem = $.extend({}, item); - - if (this.ctrlpts) { - cur_pts = [cloneItem.x += dx, cloneItem.y += dy, - cloneItem.x1, cloneItem.y1, cloneItem.x2 += dx, cloneItem.y2 += dy]; - } else { - cur_pts = [cloneItem.x += dx, cloneItem.y += dy]; - } - //fix + if (this.ctrlpts) { + cur_pts = [item.x += dx, item.y += dy, + item.x1, item.y1, item.x2 += dx, item.y2 += dy]; + } else { + cur_pts = [item.x += dx, item.y += dy]; + } svgedit.path.replacePathSeg(this.type, this.index, cur_pts); @@ -526,16 +522,12 @@ svgedit.path.Segment.prototype.setLinked = function(num) { } var item = seg.item; - // fix for path tool dom breakage, amending item does bad things now, so we take a copy and use that. Can probably improve to just take a shallow copy of object - var cloneItem = $.extend({}, item); - cloneItem['x' + anum ] = pt.x + (pt.x - this.item['x' + num]); - cloneItem['y' + anum ] = pt.y + (pt.y - this.item['y' + num]); - - var pts = [cloneItem.x, cloneItem.y, - cloneItem.x1, cloneItem.y1, - cloneItem.x2, cloneItem.y2]; - //end fix + item['x' + anum ] = pt.x + (pt.x - this.item['x' + num]); + item['y' + anum ] = pt.y + (pt.y - this.item['y' + num]); + var pts = [item.x, item.y, + item.x1, item.y1, + item.x2, item.y2]; svgedit.path.replacePathSeg(seg.type, seg.index, pts); seg.update(true); @@ -543,16 +535,11 @@ svgedit.path.Segment.prototype.setLinked = function(num) { svgedit.path.Segment.prototype.moveCtrl = function(num, dx, dy) { var item = this.item; + item['x' + num] += dx; + item['y' + num] += dy; - // fix for path tool dom breakage, amending item does bad things now, so we take a copy and use that. Can probably improve to just take a shallow copy of object - var cloneItem = $.extend({}, item); - cloneItem['x' + num] += dx; - cloneItem['y' + num] += dy; - - var pts = [cloneItem.x,cloneItem.y, - cloneItem.x1,cloneItem.y1, cloneItem.x2,cloneItem.y2]; - // end fix - + var pts = [item.x,item.y, + item.x1,item.y1, item.x2,item.y2]; svgedit.path.replacePathSeg(this.type, this.index, pts); this.update(true); diff --git a/test/path_test.html b/test/path_test.html index 20c40d06..3c80708e 100644 --- a/test/path_test.html +++ b/test/path_test.html @@ -6,6 +6,9 @@ + + +