From 05765706dc2ac448c5ecf0804b73c7ec6cde90b7 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 10 Sep 2009 20:34:20 +0000 Subject: [PATCH] Fixed poly creation on zoom git-svn-id: http://svg-edit.googlecode.com/svn/trunk@624 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index c32463c0..ce21537e 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -417,6 +417,7 @@ function BatchCommand(text) { mgr.selectorMap = {}; mgr.selectors = []; mgr.rubberBandBox = null; + mgr.update(); }; this.requestSelector = function(elem) { @@ -1845,8 +1846,8 @@ function BatchCommand(text) { case "poly": var line = document.getElementById("poly_stretch_line"); if (line) { - line.setAttribute("x2", x); - line.setAttribute("y2", y); + line.setAttribute("x2", x *= current_zoom); + line.setAttribute("y2", y *= current_zoom); } break; case "polyedit": @@ -2168,7 +2169,10 @@ function BatchCommand(text) { element = null; // continue to be set to true so that mouseMove happens started = true; - + var real_x = x; + var real_y = y; + x /= current_zoom; + y /= current_zoom; var stretchy = document.getElementById("poly_stretch_line"); if (!stretchy) { stretchy = document.createElementNS(svgns, "line"); @@ -2202,12 +2206,12 @@ function BatchCommand(text) { }); // set stretchy line to first point assignAttributes(stretchy, { - 'x1': x, - 'y1': y, - 'x2': x, - 'y2': y + 'x1': real_x, + 'y1': real_y, + 'x2': real_x, + 'y2': real_y }); - addPointGripToPoly(x,y,0); + addPointGripToPoly(real_x,real_y,0); } else { // determine if we clicked on an existing point @@ -2223,7 +2227,7 @@ function BatchCommand(text) { break; } } - + // get poly element that we are in the process of creating var poly = svgdoc.getElementById(getId()); @@ -2259,12 +2263,12 @@ function BatchCommand(text) { // set stretchy line to latest point assignAttributes(stretchy, { - 'x1': x, - 'y1': y, - 'x2': x, - 'y2': y + 'x1': real_x, + 'y1': real_y, + 'x2': real_x, + 'y2': real_y }); - addPointGripToPoly(x,y,(current_poly_pts.length/2 - 1)); + addPointGripToPoly(real_x,real_y,(current_poly_pts.length/2 - 1)); } keep = true; }