Code

Make sure that guides always snap correctly when dropping them, and improve persevera...
[inkscape.git] / src / ui / tool / control-point.cpp
index a03a8b639ade684bff24c123edceb37d3c8db4ed..b9a793ca4051952dd2bdba04c34af4ba4fb024a6 100644 (file)
@@ -378,10 +378,15 @@ bool ControlPoint::_eventHandler(GdkEvent *event)
         
     case GDK_BUTTON_RELEASE:
         if (_event_grab && event->button.button == 1) {
-            // TODO I think snapping on release is wrong, or at least counter-intuitive.
-            sp_event_context_snap_watchdog_callback(_desktop->event_context->_delayed_snap_event);
-            sp_event_context_discard_delayed_snap_event(_desktop->event_context);
-            _desktop->snapindicator->remove_snaptarget();
+            // If we have any pending snap event, then invoke it now!
+            // (This is needed because we might not have snapped on the latest GDK_MOTION_NOTIFY event
+            // if the mouse speed was too high. This is inherent to the snap-delay mechanism.
+            // We must snap at some point in time though, and this is our last chance)
+            // PS: For other contexts this is handled already in sp_event_context_item_handler or
+            // sp_event_context_root_handler
+            if (_desktop->event_context->_delayed_snap_event) {
+                sp_event_context_snap_watchdog_callback(_desktop->event_context->_delayed_snap_event);
+            }
 
             sp_canvas_item_ungrab(_canvas_item, event->button.time);
             _setMouseover(this, event->button.state);