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
master
Jeff Schiller 2009-09-13 04:09:33 +00:00
parent 922b8c65ca
commit 14725fb8bf
1 changed files with 8 additions and 4 deletions

View File

@ -3243,8 +3243,11 @@ function BatchCommand(text) {
this.moveSelectedElements = function(dx,dy,undoable) { this.moveSelectedElements = function(dx,dy,undoable) {
// if undoable is not sent, default to true // if undoable is not sent, default to true
dx *= current_zoom; // if single values, scale them to the zoom
dy *= current_zoom; if (dx.constructor != Array) {
dx *= current_zoom;
dy *= current_zoom;
}
var undoable = undoable || true; var undoable = undoable || true;
var batchCmd = new BatchCommand("position"); var batchCmd = new BatchCommand("position");
var i = selectedElements.length; var i = selectedElements.length;
@ -3254,12 +3257,12 @@ function BatchCommand(text) {
selectedBBoxes[i] = this.getBBox(selected); selectedBBoxes[i] = this.getBBox(selected);
// dx and dy could be arrays // dx and dy could be arrays
if (dx.constructor == Array) { if (dx.constructor == Array) {
selectedBBoxes[i].x += dx[i]; selectedBBoxes[i].x += dx[i] * current_zoom;
} else { } else {
selectedBBoxes[i].x += dx; selectedBBoxes[i].x += dx;
} }
if (dy.constructor == Array) { if (dy.constructor == Array) {
selectedBBoxes[i].y += dy[i]; selectedBBoxes[i].y += dy[i] * current_zoom;
} else { } else {
selectedBBoxes[i].y += dy; selectedBBoxes[i].y += dy;
} }
@ -3511,6 +3514,7 @@ function BatchCommand(text) {
this.moveSelectedElements(dx,dy); this.moveSelectedElements(dx,dy);
}; };
this.getCurrentZoom = function() { return this.current_zoom; }
} }
// Static class for various utility functions // Static class for various utility functions