From d3cca22e7c3228995aab24b9ce38466b380e783e Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 2 Sep 2009 22:17:04 +0000 Subject: [PATCH] Partial fix for Issue 158: rotations can be undone when using the angle context panel control git-svn-id: http://svg-edit.googlecode.com/svn/trunk@530 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 9fed88c2..89e4ee5f 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2696,6 +2696,8 @@ function SvgCanvas(c) if (elem == null) continue; var oldval = (attr == "#text" ? elem.textContent : elem.getAttribute(attr)); + // if the attribute was currently not set, store an empty string (cannot store null) + if (oldval == null) { oldval = ""; } if (oldval != val) { if (attr == "#text") { elem.textContent = val; @@ -2703,6 +2705,9 @@ function SvgCanvas(c) } else elem.setAttribute(attr, val); selectedBBoxes[i] = this.getBBox(elem); + // FIXME: I think this 'if' is never accessed + // When would we have a element and be changing font-size, font-family, x, or y + // so that it starts with "url(" ? if(elem.nodeName == 'text') { if((val+'').indexOf('url') == 0 || $.inArray(attr, ['font-size','font-family','x','y']) != -1) { elem = canvas.quickClone(elem); @@ -2719,7 +2724,7 @@ function SvgCanvas(c) // we need to update the rotational transform attribute and store it as part // of our changeset var angle = canvas.getRotationAngle(elem); - if (angle) { + if (angle && attr != "transform") { var cx = selectedBBoxes[i].x + selectedBBoxes[i].width/2, cy = selectedBBoxes[i].y + selectedBBoxes[i].height/2; var rotate = ["rotate(", angle, " ", cx, ",", cy, ")"].join(''); @@ -2728,7 +2733,6 @@ function SvgCanvas(c) changes['transform'] = rotate; } } - batchCmd.addSubCommand(new ChangeElementCommand(elem, changes, attr)); } }