summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a88240c)
raw | patch | inline | side by side (parent: a88240c)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Fri, 13 Mar 2009 22:00:28 +0000 (22:00 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Fri, 13 Mar 2009 22:00:28 +0000 (22:00 +0000) |
src/desktop-events.cpp | patch | blob | history |
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 8f5b53246a1169979e9f612e487ecd81d2c616f7..f77f3de354c42f9719150951d9ed977567f5b32e 100644 (file)
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
double tol = 40.0;
Geom::Point const event_w(event->button.x, event->button.y);
Geom::Point const event_dt(desktop->w2d(event_w));
- drag_origin = event_dt;
+
+ // Due to the tolerance allowed when grabbing a guide, event_dt will generally
+ // be close to the guide but not just exactly on it. The drag origin calculated
+ // here must be exactly on the guide line though, otherwise
+ // small errors will occur once we snap, see
+ // https://bugs.launchpad.net/inkscape/+bug/333762
+ drag_origin = Geom::projection(event_dt, Geom::Line(guide->point_on_line, guide->angle()));
+
if (Geom::L2(guide->point_on_line - event_dt) < tol) {
// the click was on the guide 'anchor'
drag_type = (event->button.state & GDK_SHIFT_MASK) ? SP_DRAG_MOVE_ORIGIN : SP_DRAG_TRANSLATE;