Skip to content

fix(gestures): stop maps blocking parent scrolling when panning is disabled - #2298

Draft
richyo-codes wants to merge 1 commit into
fleaflet:masterfrom
richyo-codes:fix/cooperative-map-scroll-261115
Draft

richyo-codes wants to merge 1 commit into
fleaflet:masterfrom
richyo-codes:fix/cooperative-map-scroll-261115

Conversation

@richyo-codes

Copy link
Copy Markdown

Summary

When a map is embedded in a scrolling page with panning disabled, a one-finger swipe over the map can leave both the map and the page stationary. The map’s scale recognizer claims the gesture even though drag and fling are disabled, preventing the parent scroll view from handling it.

This change lets the parent receive ordinary one-finger drags when the map has no enabled interaction that can use them. Pinch zoom, normal map dragging, cursor rotation, and double-tap-drag zoom remain available when enabled.

Reproduction

  1. Place a FlutterMap inside a SingleChildScrollView with enough content to scroll.

  2. Disable map dragging and fling:

    interactionOptions: InteractionOptions(
      flags: InteractiveFlag.all &
          ~(InteractiveFlag.drag | InteractiveFlag.flingAnimation),
    ),
    
  3. Swipe upward over the map with one finger.

Before: The map can consume the swipe without moving, blocking page scrolling.

After: The page scrolls while the map center stays unchanged.

Implementation

The interaction flags already prevent map movement in the gesture callbacks, but those checks occur after gesture recognition. The scale recognizer now checks whether an enabled map interaction can use a one-pointer gesture before accepting it.

Validation

All five regression tests pass:

  • Parent scrolling with small and large initial pointer movements.
  • Two-finger pinch zoom.
  • Normal map dragging with default interaction flags.
  • Double-tap-drag zoom.

Analysis reports no errors or warnings with informational diagnostics nonfatal. The installed Flutter SDK emits existing Material import deprecation notices. Minimum-version CI has not been run locally.

Related Discussions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant