From cf2a8a90055ace64b631509c4c2f8e9a1782dd2b Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Tue, 23 Jun 2009 05:46:47 +0000 Subject: [PATCH] Move normalization of selected bbox to inside mouseMove to prevent bug when selected box disappears when resizing negatively git-svn-id: http://svg-edit.googlecode.com/svn/trunk@174 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index ae7909ae..036bb786 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -141,15 +141,6 @@ function SvgCanvas(c) function recalculateSelectedDimensions() { var box = selected.getBBox(); - // normalize selectedBBox - if (selectedBBox.width < 0) { - selectedBBox.x += selectedBBox.width; - selectedBBox.width = -selectedBBox.width; - } - if (selectedBBox.height < 0) { - selectedBBox.y += selectedBBox.height; - selectedBBox.height = -selectedBBox.height; - } var remapx = function(x) {return ((x-box.x)/box.width)*selectedBBox.width + selectedBBox.x;} var remapy = function(y) {return ((y-box.y)/box.height)*selectedBBox.height + selectedBBox.y;} var scalew = function(w) {return w*selectedBBox.width/box.width;} @@ -549,6 +540,16 @@ function SvgCanvas(c) selectedBBox.y = top+ty; selectedBBox.width = width*sx; selectedBBox.height = height*sy; + // normalize selectedBBox + if (selectedBBox.width < 0) { + selectedBBox.x += selectedBBox.width; + selectedBBox.width = -selectedBBox.width; + } + if (selectedBBox.height < 0) { + selectedBBox.y += selectedBBox.height; + selectedBBox.height = -selectedBBox.height; + } + ts = "translate(" + (left+tx) + "," + (top+ty) + ") scale(" + (sx) + "," + (sy) + ") translate(" + (-left) + "," + (-top) + ")";