Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion lib/src/gestures/gestures.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ abstract class MapGestureMixin extends State<FlutterMap>
// 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<dynamic> newCenterZoom = _getNewEventCenterZoomPosition(
Expand Down