diff --git a/lib/flutter_map.dart b/lib/flutter_map.dart index 5d7b2b3b1..a8d90ba3c 100644 --- a/lib/flutter_map.dart +++ b/lib/flutter_map.dart @@ -253,6 +253,7 @@ class MapOptions { /// his mouse. This is supported on web and desktop, but might also work well /// on Android. A [Listener] is used to capture the onPointerSignal events. final bool enableScrollWheel; + final double scrollWheelVelocity; final double? minZoom; final double? maxZoom; @@ -309,6 +310,7 @@ class MapOptions { this.pinchMoveWinGestures = MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove, this.enableScrollWheel = true, + this.scrollWheelVelocity = 0.005, this.minZoom, this.maxZoom, this.interactiveFlags = InteractiveFlag.all, diff --git a/lib/src/gestures/gestures.dart b/lib/src/gestures/gestures.dart index 00e11ae44..cec76503e 100644 --- a/lib/src/gestures/gestures.dart +++ b/lib/src/gestures/gestures.dart @@ -58,7 +58,9 @@ abstract class MapGestureMixin extends State // Calculate new zoom level final minZoom = mapState.options.minZoom ?? 0.0; final maxZoom = mapState.options.maxZoom ?? double.infinity; - final newZoom = (mapState.zoom + pointerSignal.scrollDelta.dy * -0.005) + final newZoom = (mapState.zoom - + pointerSignal.scrollDelta.dy * + mapState.options.scrollWheelVelocity) .clamp(minZoom, maxZoom); // Calculate offset of mouse cursor from viewport center final List newCenterZoom = _getNewEventCenterZoomPosition(