diff --git a/editor/browser.js b/editor/browser.js index dc6ee6eb..4a70f424 100644 --- a/editor/browser.js +++ b/editor/browser.js @@ -59,7 +59,7 @@ var supportsPathReplaceItem_ = (function() { var seglist = path.pathSegList; var seg = path.createSVGPathSegLinetoAbs(5,5); try { - seglist.replaceItem(seg, 0); + seglist.replaceItem(seg, 1); return true; } catch(err) {} return false; @@ -71,7 +71,7 @@ var supportsPathInsertItemBefore_ = (function() { var seglist = path.pathSegList; var seg = path.createSVGPathSegLinetoAbs(5,5); try { - seglist.insertItemBefore(seg, 0); + seglist.insertItemBefore(seg, 1); return true; } catch(err) {} return false; 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/editor/svgcanvas.js b/editor/svgcanvas.js index 3f2cf464..a0e885ef 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -549,7 +549,7 @@ var getIntersectionList = this.getIntersectionList = function(rect) { var rubberBBox; if (!rect) { rubberBBox = rubberBox.getBBox(); - var o, bb = {}; + var o, bb = svgcontent.createSVGRect(); for (o in rubberBBox) { bb[o] = rubberBBox[o] / current_zoom; @@ -560,12 +560,14 @@ var getIntersectionList = this.getIntersectionList = function(rect) { } var resultList = null; - if (typeof(svgroot.getIntersectionList) == 'function') { - // Offset the bbox of the rubber box by the offset of the svgcontent element. - rubberBBox.x += parseInt(svgcontent.getAttribute('x'), 10); - rubberBBox.y += parseInt(svgcontent.getAttribute('y'), 10); + if (!svgedit.browser.isIE) { + if (typeof(svgroot.getIntersectionList) == 'function') { + // Offset the bbox of the rubber box by the offset of the svgcontent element. + rubberBBox.x += parseInt(svgcontent.getAttribute('x'), 10); + rubberBBox.y += parseInt(svgcontent.getAttribute('y'), 10); - resultList = svgroot.getIntersectionList(rubberBBox, parent); + resultList = svgroot.getIntersectionList(rubberBBox, parent); + } } if (resultList == null || typeof(resultList.item) != 'function') { 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 @@ + + +