Fixed undo/redo bug (I think)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1365 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-02-09 20:50:06 +00:00
parent 4b5011eb44
commit 9df43ee7ba
1 changed files with 5 additions and 6 deletions

View File

@ -163,7 +163,7 @@ function ChangeElementCommand(elem, attrs, text) {
for(var attr in this.newValues ) { for(var attr in this.newValues ) {
if (this.newValues[attr]) { if (this.newValues[attr]) {
if (attr == "#text") this.elem.textContent = 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 { else {
if (attr == "#text") this.elem.textContent = ""; if (attr == "#text") this.elem.textContent = "";
@ -199,7 +199,7 @@ function ChangeElementCommand(elem, attrs, text) {
for(var attr in this.oldValues ) { for(var attr in this.oldValues ) {
if (this.oldValues[attr]) { if (this.oldValues[attr]) {
if (attr == "#text") this.elem.textContent = 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 { else {
if (attr == "#text") this.elem.textContent = ""; if (attr == "#text") this.elem.textContent = "";
@ -973,10 +973,6 @@ function BatchCommand(text) {
elem.setAttribute(attr, val); elem.setAttribute(attr, val);
} }
convertToUnit = function(val, unit) {
}
canvas.isValidUnit = function(attr, val) { canvas.isValidUnit = function(attr, val) {
var valid = false; var valid = false;
if($.inArray(attr, unit_attrs) != -1) { if($.inArray(attr, unit_attrs) != -1) {
@ -1935,6 +1931,9 @@ function BatchCommand(text) {
// make a copy of initial values and include the transform // make a copy of initial values and include the transform
if (initial == null) { if (initial == null) {
initial = $.extend(true, {}, changes); initial = $.extend(true, {}, changes);
$.each(initial, function(attr, val) {
initial[attr] = convertToNum(attr, val);
});
} }
// save the start transform value too // save the start transform value too
initial["transform"] = start_transform ? start_transform : ""; initial["transform"] = start_transform ? start_transform : "";