Fix for odd polyedit drag error when a poly is rotated (Issue 118)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@741 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-09-29 20:49:18 +00:00
parent fd972c7901
commit a689875c27
1 changed files with 3 additions and 0 deletions

View File

@ -1949,6 +1949,7 @@ function BatchCommand(text) {
// if the image is rotated, then we must modify the x,y mouse coordinates // if the image is rotated, then we must modify the x,y mouse coordinates
// and rotate them into the shape's rotated coordinate system // and rotate them into the shape's rotated coordinate system
// we also re-map mouse_x/y and x/y into the rotated coordinate system
var angle = canvas.getRotationAngle(current_poly) * Math.PI / 180.0; var angle = canvas.getRotationAngle(current_poly) * Math.PI / 180.0;
if (angle) { if (angle) {
// calculate the shape's old center that was used for rotation // calculate the shape's old center that was used for rotation
@ -1960,6 +1961,8 @@ function BatchCommand(text) {
var theta = Math.atan2(dy,dx) - angle; var theta = Math.atan2(dy,dx) - angle;
current_poly_pts[i] = mouse_x = cx + r * Math.cos(theta); current_poly_pts[i] = mouse_x = cx + r * Math.cos(theta);
current_poly_pts[i+1] = mouse_y = cy + r * Math.sin(theta); current_poly_pts[i+1] = mouse_y = cy + r * Math.sin(theta);
x = mouse_x / current_zoom;
y = mouse_y / current_zoom;
} }
else { else {
current_poly_pts[i] = x * current_zoom; current_poly_pts[i] = x * current_zoom;