Gesture race!

This commit is contained in:
stopflock committed 2025-11-19 14:24:51 -06:00
1 parent 20870623f0
commit 5404daa704
2 files changed
+13 -4

No files matched your search

+3 -2
View File
@@ -111,9 +111,10 @@ const Duration kProximityAlertCooldown = Duration(minutes: 10); // Cooldown betw
// Map interaction configuration // Map interaction configuration
const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0) const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0)
const double kScrollWheelVelocity = 0.005; // Mouse scroll wheel zoom speed (default 0.005) const double kScrollWheelVelocity = 0.01; // Mouse scroll wheel zoom speed (default 0.005)
const double kPinchZoomThreshold = 0.5; // How much pinch required to start zoom (default 0.5) const double kPinchZoomThreshold = 0.5; // How much pinch required to start zoom (default 0.5)
const double kPinchMoveThreshold = 40.0; // How much drag required for two-finger pan (default 40.0) const double kPinchMoveThreshold = 30.0; // How much drag required for two-finger pan (default 40.0)
const double kRotationThreshold = 10.0; // Degrees of rotation required before map actually rotates (Google Maps style)
// Tile fetch retry parameters (configurable backoff system) // Tile fetch retry parameters (configurable backoff system)
const int kTileFetchMaxAttempts = 16; // Number of retry attempts before giving up const int kTileFetchMaxAttempts = 16; // Number of retry attempts before giving up
+10 -2
View File
@@ -269,6 +269,7 @@ class MapViewState extends State<MapView> {
if (editSession?.originalNode.isConstrained == true) { if (editSession?.originalNode.isConstrained == true) {
// Constrained node: only allow pinch zoom and rotation, disable ALL panning // Constrained node: only allow pinch zoom and rotation, disable ALL panning
return const InteractionOptions( return const InteractionOptions(
enableMultiFingerGestureRace: true,
flags: InteractiveFlag.pinchZoom | InteractiveFlag.rotate, flags: InteractiveFlag.pinchZoom | InteractiveFlag.rotate,
scrollWheelVelocity: kScrollWheelVelocity, scrollWheelVelocity: kScrollWheelVelocity,
pinchZoomThreshold: kPinchZoomThreshold, pinchZoomThreshold: kPinchZoomThreshold,
@@ -276,9 +277,16 @@ class MapViewState extends State<MapView> {
); );
} }
// Normal case: all interactions allowed // Normal case: all interactions allowed with gesture race to prevent accidental rotation during zoom
return const InteractionOptions( return const InteractionOptions(
flags: InteractiveFlag.all, enableMultiFingerGestureRace: true,
flags: InteractiveFlag.doubleTapDragZoom |
InteractiveFlag.doubleTapZoom |
InteractiveFlag.drag |
InteractiveFlag.flingAnimation |
InteractiveFlag.pinchZoom |
InteractiveFlag.rotate |
InteractiveFlag.scrollWheelZoom,
scrollWheelVelocity: kScrollWheelVelocity, scrollWheelVelocity: kScrollWheelVelocity,
pinchZoomThreshold: kPinchZoomThreshold, pinchZoomThreshold: kPinchZoomThreshold,
pinchMoveThreshold: kPinchMoveThreshold, pinchMoveThreshold: kPinchMoveThreshold,