Fixed poly creation on zoom

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@624 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2009-09-10 20:34:20 +00:00
parent 68716b04a7
commit 05765706dc
1 changed files with 18 additions and 14 deletions

View File

@ -417,6 +417,7 @@ function BatchCommand(text) {
mgr.selectorMap = {}; mgr.selectorMap = {};
mgr.selectors = []; mgr.selectors = [];
mgr.rubberBandBox = null; mgr.rubberBandBox = null;
mgr.update();
}; };
this.requestSelector = function(elem) { this.requestSelector = function(elem) {
@ -1845,8 +1846,8 @@ function BatchCommand(text) {
case "poly": case "poly":
var line = document.getElementById("poly_stretch_line"); var line = document.getElementById("poly_stretch_line");
if (line) { if (line) {
line.setAttribute("x2", x); line.setAttribute("x2", x *= current_zoom);
line.setAttribute("y2", y); line.setAttribute("y2", y *= current_zoom);
} }
break; break;
case "polyedit": case "polyedit":
@ -2168,7 +2169,10 @@ function BatchCommand(text) {
element = null; element = null;
// continue to be set to true so that mouseMove happens // continue to be set to true so that mouseMove happens
started = true; started = true;
var real_x = x;
var real_y = y;
x /= current_zoom;
y /= current_zoom;
var stretchy = document.getElementById("poly_stretch_line"); var stretchy = document.getElementById("poly_stretch_line");
if (!stretchy) { if (!stretchy) {
stretchy = document.createElementNS(svgns, "line"); stretchy = document.createElementNS(svgns, "line");
@ -2202,12 +2206,12 @@ function BatchCommand(text) {
}); });
// set stretchy line to first point // set stretchy line to first point
assignAttributes(stretchy, { assignAttributes(stretchy, {
'x1': x, 'x1': real_x,
'y1': y, 'y1': real_y,
'x2': x, 'x2': real_x,
'y2': y 'y2': real_y
}); });
addPointGripToPoly(x,y,0); addPointGripToPoly(real_x,real_y,0);
} }
else { else {
// determine if we clicked on an existing point // determine if we clicked on an existing point
@ -2223,7 +2227,7 @@ function BatchCommand(text) {
break; break;
} }
} }
// get poly element that we are in the process of creating // get poly element that we are in the process of creating
var poly = svgdoc.getElementById(getId()); var poly = svgdoc.getElementById(getId());
@ -2259,12 +2263,12 @@ function BatchCommand(text) {
// set stretchy line to latest point // set stretchy line to latest point
assignAttributes(stretchy, { assignAttributes(stretchy, {
'x1': x, 'x1': real_x,
'y1': y, 'y1': real_y,
'x2': x, 'x2': real_x,
'y2': y '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; keep = true;
} }