From 14725fb8bfbb1133fc6b064dbbb49834e0e45184 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Sun, 13 Sep 2009 04:09:33 +0000 Subject: [PATCH] Fix Issue 192: broken while working on the zoom feature git-svn-id: http://svg-edit.googlecode.com/svn/trunk@630 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index cfa234c3..64e5a9d7 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -3243,8 +3243,11 @@ function BatchCommand(text) { this.moveSelectedElements = function(dx,dy,undoable) { // if undoable is not sent, default to true - dx *= current_zoom; - dy *= current_zoom; + // if single values, scale them to the zoom + if (dx.constructor != Array) { + dx *= current_zoom; + dy *= current_zoom; + } var undoable = undoable || true; var batchCmd = new BatchCommand("position"); var i = selectedElements.length; @@ -3254,12 +3257,12 @@ function BatchCommand(text) { selectedBBoxes[i] = this.getBBox(selected); // dx and dy could be arrays if (dx.constructor == Array) { - selectedBBoxes[i].x += dx[i]; + selectedBBoxes[i].x += dx[i] * current_zoom; } else { selectedBBoxes[i].x += dx; } if (dy.constructor == Array) { - selectedBBoxes[i].y += dy[i]; + selectedBBoxes[i].y += dy[i] * current_zoom; } else { selectedBBoxes[i].y += dy; } @@ -3511,6 +3514,7 @@ function BatchCommand(text) { this.moveSelectedElements(dx,dy); }; + this.getCurrentZoom = function() { return this.current_zoom; } } // Static class for various utility functions