From 281e70de9a4f51ca82244a9fee9ed4a124ed447c Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 8 Jun 2010 16:48:41 +0000 Subject: [PATCH] Fixed issue 559: Polyline doesn't rotate correctly in safari and chrome. Also made undo/redo work better for markers git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1589 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/extensions/ext-markers.js | 6 ++++++ editor/svgcanvas.js | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/editor/extensions/ext-markers.js b/editor/extensions/ext-markers.js index d0dd53f3..131b74ec 100644 --- a/editor/extensions/ext-markers.js +++ b/editor/extensions/ext-markers.js @@ -301,10 +301,16 @@ svgEditor.addExtension("Markers", function(S) { var m = elem.getAttribute(nam); if (m) pline.setAttribute(nam,elem.getAttribute(nam)); }); + + var batchCmd = new S.BatchCommand(); + batchCmd.addSubCommand(new S.RemoveElementCommand(elem, elem.parentNode)); + batchCmd.addSubCommand(new S.InsertElementCommand(pline)); + $(elem).after(pline).remove(); svgCanvas.clearSelection(); pline.id = id; svgCanvas.addToSelection([pline]); + S.addCommandToHistory(batchCmd); return pline; } diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index f1fab17c..89cdc3ea 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -315,7 +315,11 @@ function RemoveElementCommand(elem, parent, text) { this.text = text || ("Delete " + elem.tagName); this.parent = parent; - this.apply = function() { + this.apply = function() { + if (svgTransformLists[this.elem.id]) { + delete svgTransformLists[this.elem.id]; + } + this.parent = this.elem.parentNode; this.elem = this.parent.removeChild(this.elem); if (this.parent == svgcontent) { @@ -324,6 +328,10 @@ function RemoveElementCommand(elem, parent, text) { }; this.unapply = function() { + if (svgTransformLists[this.elem.id]) { + delete svgTransformLists[this.elem.id]; + } + this.elem = this.parent.insertBefore(this.elem, this.elem.nextSibling); if (this.parent == svgcontent) { identifyLayers();