summaryrefslogtreecommitdiffstats
path: root/src/desktop-events.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-03-13 22:00:28 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-03-13 22:00:28 +0000
commit467b1f0f1700b08fc6f64439043a145c1f265fea (patch)
tree74354e8d0a1cdacb030956032d8bfc2e1ae1b290 /src/desktop-events.cpp
parent* [INTL: it] Fixed a really bad mistaken translation, thanks (diff)
downloadinkscape-467b1f0f1700b08fc6f64439043a145c1f265fea.tar.gz
inkscape-467b1f0f1700b08fc6f64439043a145c1f265fea.zip
Fix bug #333762: snapping a guide while dragging/rotating, it always ends up being just a little bit off (started occuring after the recent guide handling improvements)
(bzr r7481)
Diffstat (limited to 'src/desktop-events.cpp')
-rw-r--r--src/desktop-events.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 8f5b53246..f77f3de35 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -271,7 +271,14 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
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;