fixtransforms branch: Remove zero-degree rotations and empty transform strings

git-svn-id: http://svg-edit.googlecode.com/svn/branches/fixtransforms@1055 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-12-17 15:12:54 +00:00
parent 48c4aa0e97
commit 729900d796
1 changed files with 22 additions and 9 deletions

View File

@ -1550,7 +1550,10 @@ function BatchCommand(text) {
}
// if this element had no transforms, we are done
if (tlist.numberOfItems == 0) return null;
if (tlist.numberOfItems == 0) {
selected.removeAttribute("transform");
return null;
}
// we know we have some transforms, so set up return variable
var batchCmd = new BatchCommand("Transform");
@ -1797,9 +1800,14 @@ function BatchCommand(text) {
// (this function has zero work to do for a rotate())
else {
operation = 4; // rotation
var newRot = svgroot.createSVGTransform();
newRot.setRotate(angle,newcenter.x,newcenter.y);
tlist.insertItemBefore(newRot, 0);
if (angle) {
var newRot = svgroot.createSVGTransform();
newRot.setRotate(angle,newcenter.x,newcenter.y);
tlist.insertItemBefore(newRot, 0);
}
if (tlist.numberOfItems == 0) {
selected.removeAttribute("transform");
}
return null;
}
@ -4109,7 +4117,7 @@ function BatchCommand(text) {
addCommandToHistory(new InsertElementCommand(element));
call("changed",[element]);
}
start_transform = null;
};
@ -5238,10 +5246,15 @@ function BatchCommand(text) {
}
// find R_nc and insert it
var center = transformPoint(cx,cy,transformListToTransform(tlist).matrix);
var R_nc = svgroot.createSVGTransform();
R_nc.setRotate(val, center.x, center.y);
tlist.insertItemBefore(R_nc,0);
if (val != 0) {
var center = transformPoint(cx,cy,transformListToTransform(tlist).matrix);
var R_nc = svgroot.createSVGTransform();
R_nc.setRotate(val, center.x, center.y);
tlist.insertItemBefore(R_nc,0);
}
else if (tlist.numberOfItems == 0) {
elem.removeAttribute("transform");
}
if (!preventUndo) {
// we need to undo it, then redo it so it can be undo-able! :)