From 5f712680b7ff464f9e1f73d36942a51347594dcb Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Thu, 12 Jul 2012 01:08:45 -0500 Subject: [PATCH] rects now scale from the center with alt --- editor/svgcanvas.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 2cf7f6c..c6d1e26 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2913,7 +2913,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) { ty = snapToGrid(ty); } - translateOrigin.setTranslate(-(left+tx),-(top+ty)); + translateOrigin.setTranslate(tox,toy); if(evt.shiftKey) { if(sx == 1) sx = sy else sy = sx; @@ -2978,7 +2978,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) { case "square": // fall through case "rect": - // fall through case "image": var square = (current_mode == 'square') || evt.shiftKey, w = Math.abs(x - start_x), @@ -2992,6 +2991,12 @@ var getMouseTarget = this.getMouseTarget = function(evt) { new_x = Math.min(start_x,x); new_y = Math.min(start_y,y); } + if (evt.altKey){ + w *=2; + h *=2; + new_x = start_x - w/2; + new_y = start_y - h/2; + } if(curConfig.gridSnapping){ w = snapToGrid(w);