From 9cc1f95276dcbb405ba59e155fc37ff1433b449e Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Wed, 22 Apr 2026 15:41:08 +0200 Subject: [PATCH] Don't select when the mouse is moving before a click. Considere event history in SmockInteractionsStrategy --- src/GeoView/GeoViewInteractionsStrategy.class.st | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/GeoView/GeoViewInteractionsStrategy.class.st b/src/GeoView/GeoViewInteractionsStrategy.class.st index 7980b18..4b1df9d 100644 --- a/src/GeoView/GeoViewInteractionsStrategy.class.st +++ b/src/GeoView/GeoViewInteractionsStrategy.class.st @@ -93,11 +93,12 @@ GeoViewInteractionsStrategy >> mouseDownEvent: anEvent [ GeoViewInteractionsStrategy >> mouseMoveEvent: anEvent [ "Sampling mouse events" - lastMouseMoveEventTimestamp ifNotNil:[ | duration | - duration := anEvent timestamp - lastMouseMoveEventTimestamp. + | lastMouseMoveEvent | + lastMouseMoveEvent := self getLastEvent: BlMouseMoveEvent. + lastMouseMoveEvent ifNotNil:[ | duration | + duration := anEvent timestamp - lastMouseMoveEvent timestamp. duration < self pulseDuration ifTrue:[ ^ self ]. ]. - lastMouseMoveEventTimestamp := anEvent timestamp copy. self sendMouseCoordinatesChanged: anEvent. @@ -176,10 +177,16 @@ GeoViewInteractionsStrategy >> moveMap: anEvent [ { #category : #'mouse handlers' } GeoViewInteractionsStrategy >> primaryClickEvent: anEvent [ + | from distance | self allowSelection ifFalse:[ ^ self ]. self isMapMoving ifTrue:[ ^ self ]. - self selectOnClick: anEvent + "determine if selection is available depending mouse cursor distance between mouseDown and mouseClick" + from := (self getLastEvent: BlPrimaryMouseDownEvent) ifNotNil:[ :e | e position ] ifNil:[ anEvent position ]. + distance := anEvent position distanceTo: from. + distance > self pickingRadius ifTrue:[ ^ self ]. + + self selectOnClick: anEvent ] { #category : #'mouse handlers' }