Fixed issue 287 by adding x,y fields for freehand lines, paths and groups

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@961 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2009-11-20 17:17:55 +00:00
parent 2441b75477
commit 6d2729cf6b
3 changed files with 40 additions and 24 deletions

View File

@@ -5256,6 +5256,15 @@ function BatchCommand(text) {
while (i--) {
var elem = elems[i];
if (elem == null) continue;
// Set x,y vals on elements that don't have them
if((attr == 'x' || attr == 'y') && $.inArray(elem.tagName, ['g', 'polyline', 'path']) != -1) {
var bbox = canvas.getStrokedBBox([elem]);
var diff_x = attr == 'x' ? newValue - bbox.x : 0;
var diff_y = attr == 'y' ? newValue - bbox.y : 0;
canvas.moveSelectedElements(diff_x*current_zoom, diff_y*current_zoom, true);
continue;
}
// only allow the transform/opacity attribute to change on <g> elements, slightly hacky
if (elem.tagName == "g" && (attr != "transform" && attr != "opacity")) continue;
var oldval = attr == "#text" ? elem.textContent : elem.getAttribute(attr);