From 9df43ee7baa60eefc9f008f8885f8616cbd6391c Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 9 Feb 2010 20:50:06 +0000 Subject: [PATCH] Fixed undo/redo bug (I think) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1365 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 74d16e4a..2e3c52ac 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -163,7 +163,7 @@ function ChangeElementCommand(elem, attrs, text) { for(var attr in this.newValues ) { if (this.newValues[attr]) { if (attr == "#text") this.elem.textContent = this.newValues[attr]; - else setUnitAttr(this.elem, attr, this.newValues[attr]); + else this.elem.setAttribute(attr, this.newValues[attr]); } else { if (attr == "#text") this.elem.textContent = ""; @@ -199,7 +199,7 @@ function ChangeElementCommand(elem, attrs, text) { for(var attr in this.oldValues ) { if (this.oldValues[attr]) { if (attr == "#text") this.elem.textContent = this.oldValues[attr]; - else setUnitAttr(this.elem, attr, this.newValues[attr]); + else this.elem.setAttribute(attr, this.oldValues[attr]); } else { if (attr == "#text") this.elem.textContent = ""; @@ -973,10 +973,6 @@ function BatchCommand(text) { elem.setAttribute(attr, val); } - convertToUnit = function(val, unit) { - - } - canvas.isValidUnit = function(attr, val) { var valid = false; if($.inArray(attr, unit_attrs) != -1) { @@ -1935,6 +1931,9 @@ function BatchCommand(text) { // make a copy of initial values and include the transform if (initial == null) { initial = $.extend(true, {}, changes); + $.each(initial, function(attr, val) { + initial[attr] = convertToNum(attr, val); + }); } // save the start transform value too initial["transform"] = start_transform ? start_transform : "";