Issue 40: Fix move, resize, rotate of groups. Ungroup with rotations do not work properly yet.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@604 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
45388a21f3
commit
e1382ac70a
|
@ -974,8 +974,35 @@ function BatchCommand(text) {
|
|||
}
|
||||
}
|
||||
|
||||
// if it's a group, transfer the transform attribute to each child element
|
||||
// and recursively call recalculateDimensions()
|
||||
if (selected.tagName == "g") {
|
||||
var batchCmd = new BatchCommand("Transform Group");
|
||||
var xform = selected.getAttribute("transform");
|
||||
var children = selected.childNodes;
|
||||
var i = children.length;
|
||||
while (i--) {
|
||||
var child = children.item(i);
|
||||
if (child.nodeType == 1) {
|
||||
var childBox = child.getBBox();
|
||||
if (childBox) {
|
||||
var pt = remap(childBox.x,childBox.y),
|
||||
w = scalew(childBox.width),
|
||||
h = scaleh(childBox.height);
|
||||
childBox.x = pt.x; childBox.y = pt.y;
|
||||
childBox.width = w; childBox.height = h;
|
||||
batchCmd.addSubCommand(recalculateDimensions(child, childBox));
|
||||
}
|
||||
}
|
||||
}
|
||||
return batchCmd;
|
||||
}
|
||||
|
||||
switch (selected.tagName)
|
||||
{
|
||||
case "g":
|
||||
// do work here :P
|
||||
break;
|
||||
// NOTE: at the moment, there's no way to create an actual polygon element except by
|
||||
// editing source or importing from somewhere else but we'll cover it here anyway
|
||||
// polygon is handled just like polyline
|
||||
|
@ -1153,9 +1180,6 @@ function BatchCommand(text) {
|
|||
'height': scaleh(changes["height"])
|
||||
}, 1000);
|
||||
break;
|
||||
case "g":
|
||||
// do work here :P
|
||||
break;
|
||||
default: // rect
|
||||
console.log("Unknown shape type: " + selected.tagName);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue