From e0762361898748e8a6943d30ef1b5b070d4498a1 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 23 Jan 2010 14:58:50 +0100 Subject: [PATCH] Fix snap bug as reported by Arcadie Cracan on the developers mailing list, dating 2009-10-28 --- src/event-context.cpp | 22 +++++++++------------- src/snap-enums.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/event-context.cpp b/src/event-context.cpp index 100e6b143..5592741d9 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -934,25 +934,21 @@ gint sp_event_context_item_handler(SPEventContext * event_context, SPItem * item, GdkEvent * event) { switch (event->type) { case GDK_MOTION_NOTIFY: - sp_event_context_snap_delay_handler(event_context, item, NULL, - (GdkEventMotion *) event, - DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER); + sp_event_context_snap_delay_handler(event_context, item, NULL, (GdkEventMotion *) event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER); break; case GDK_BUTTON_RELEASE: if (event_context->_delayed_snap_event) { // If we have any pending snapping action, then invoke it now - sp_event_context_snap_watchdog_callback( - event_context->_delayed_snap_event); + sp_event_context_snap_watchdog_callback(event_context->_delayed_snap_event); } break; - /*case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - // Snapping will be on hold if we're moving the mouse at high speeds. When starting - // drawing a new shape we really should snap though. - event_context->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false); - break; - */ + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + // Snapping will be on hold if we're moving the mouse at high speeds. When starting + // drawing a new shape we really should snap though. + event_context->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(false); + break; default: break; } diff --git a/src/snap-enums.h b/src/snap-enums.h index 41cc65abb..60893de6a 100644 --- a/src/snap-enums.h +++ b/src/snap-enums.h @@ -64,7 +64,7 @@ enum SnapSourceType { SNAPSOURCE_CORNER, // of image or of rectangle SNAPSOURCE_CONVEX_HULL_CORNER, SNAPSOURCE_ELLIPSE_QUADRANT_POINT, - SNAPSOURCE_NODE_HANDLE, + SNAPSOURCE_NODE_HANDLE, // eg. nodes in the path editor, handles of stars or rectangles, etc. (tied to a stroke) //------------------------------------------------------------------- // Other points (e.g. guides, gradient knots) will snap to both bounding boxes and nodes SNAPSOURCE_OTHER_CATEGORY = 1024, // will be used as a flag and must therefore be a power of two @@ -74,7 +74,7 @@ enum SnapSourceType { SNAPSOURCE_GUIDE, SNAPSOURCE_GUIDE_ORIGIN, SNAPSOURCE_TEXT_BASELINE, - SNAPSOURCE_OTHER_HANDLE + SNAPSOURCE_OTHER_HANDLE // eg. the handle of a gradient of a connector (ie not being tied to a stroke) }; } -- 2.30.2