Skip to content

Commit

Permalink
fix: add doubleTapDragZoom and scrollWheelZoom to `InteractiveFla…
Browse files Browse the repository at this point in the history
…g.all` (#1726)

Co-authored-by: JaffaKetchup <github@jaffaketchup.dev>
  • Loading branch information
2 people authored and josxha committed Nov 28, 2023
1 parent 8020d3e commit 393e986
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/src/gestures/flutter_map_interactive_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ class FlutterMapInteractiveViewerState
void _onPointerSignal(PointerSignalEvent pointerSignal) {
// Handle mouse scroll events if the enableScrollWheel parameter is enabled
if (pointerSignal is PointerScrollEvent &&
(InteractiveFlag.hasFlag(
_interactionOptions.flags, InteractiveFlag.scrollWheelZoom) ||
(InteractiveFlag.hasScrollWheelZoom(_interactionOptions.flags) ||
// ignore: deprecated_member_use_from_same_package
_interactionOptions.enableScrollWheel) &&
pointerSignal.scrollDelta.dy != 0) {
Expand Down
16 changes: 13 additions & 3 deletions lib/src/gestures/interactive_flag.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// If you want mix interactions for example drag and rotate interactions then
/// you have two options:
/// a. Add you own flags: [InteractiveFlag.drag] | [InteractiveFlag.rotate]
/// a. Add your own flags: [InteractiveFlag.drag] | [InteractiveFlag.rotate]
/// b. Remove unnecessary flags from all:
/// [InteractiveFlag.all] &
/// ~[InteractiveFlag.flingAnimation] &
Expand All @@ -14,8 +14,15 @@
abstract class InteractiveFlag {
const InteractiveFlag._();

static const int all =
drag | flingAnimation | pinchMove | pinchZoom | doubleTapZoom | rotate;
static const int all = drag |
flingAnimation |
pinchMove |
pinchZoom |
doubleTapZoom |
doubleTapDragZoom |
scrollWheelZoom |
rotate;

static const int none = 0;

/// Enable panning with a single finger or cursor
Expand Down Expand Up @@ -83,4 +90,7 @@ abstract class InteractiveFlag {

/// True if the [rotate] interactive flag is enabled.
static bool hasRotate(int flags) => hasFlag(flags, rotate);

/// True if the [scrollWheelZoom] interactive flag is enabled.
static bool hasScrollWheelZoom(int flags) => hasFlag(flags, scrollWheelZoom);
}

0 comments on commit 393e986

Please sign in to comment.