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();