From 38242ad3d66ea270887279ec2acafadd504ccc4d Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 12 Nov 2009 18:38:13 +0000 Subject: [PATCH] Fixed alignment tools git-svn-id: http://svg-edit.googlecode.com/svn/trunk@935 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index e7c7daf6..85e0576a 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -5444,17 +5444,23 @@ function BatchCommand(text) { var selected = selectedElements[i]; if (selected != null) { selectedBBoxes[i] = this.getBBox(selected); + + var xform = svgroot.createSVGTransform(); + var tlist = canvas.getTransformList(selected); + // dx and dy could be arrays if (dx.constructor == Array) { selectedBBoxes[i].x += dx[i]; + selectedBBoxes[i].y += dy[i]; + xform.setTranslate(dx[i],dy[i]); } else { selectedBBoxes[i].x += dx; - } - if (dy.constructor == Array) { - selectedBBoxes[i].y += dy[i]; - } else { selectedBBoxes[i].y += dy; + xform.setTranslate(dx,dy); } + + tlist.appendItem(xform); + var cmd = recalculateDimensions(selected);//,selectedBBoxes[i]); if (cmd) { batchCmd.addSubCommand(cmd); @@ -5716,7 +5722,7 @@ function BatchCommand(text) { for (var i = 0; i < len; ++i) { if (selectedElements[i] == null) break; var elem = selectedElements[i]; - bboxes[i] = canvas.getStrokedBBox(elem); + bboxes[i] = canvas.getStrokedBBox([elem]); // now bbox is axis-aligned and handles rotation switch (relative_to) {