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