Skip to content

fix: load tiles during double-tap-and-drag (one finger) zoom gesture#2217

Open
ProstoSanja wants to merge 1 commit into
fleaflet:masterfrom
ProstoSanja:fix/double-tap-drag-zoom-tile-updates
Open

fix: load tiles during double-tap-and-drag (one finger) zoom gesture#2217
ProstoSanja wants to merge 1 commit into
fleaflet:masterfrom
ProstoSanja:fix/double-tap-drag-zoom-tile-updates

Conversation

@ProstoSanja

Copy link
Copy Markdown

fix: load tiles during double-tap-and-drag (one finger) zoom gesture

Problem

The double-tap-and-drag zoom gesture (double-tap, hold, then drag to zoom with
one finger — InteractiveFlag.doubleTapDragZoom) doesn't load new tiles while
the gesture is ongoing. The map zooms visually, but TileLayer keeps showing
the stale/upscaled/missing tiles and only loads the correct ones once the finger is
released. Pinch-to-zoom is unaffected by this behaviour.

Root cause

TileLayer only loads tiles in response to events on
MapController.mapEventStream. Every gesture-driven camera change flows through
MapControllerImpl.moveRaw, which builds its event via
MapEventWithMove.fromSource(...) (lib/src/gestures/map_events.dart):

switch (source) {
  ...
  MapEventSource.onDrag ||
  MapEventSource.onMultiFinger ||   // pinch zoom
  MapEventSource.mapController ||
  MapEventSource.keyboard ||
  MapEventSource.custom            => MapEventMove(...),
  _                                => null,   // ← doubleTapHold lands here
}

MapInteractiveViewer._handleDoubleTapHold drives the gesture with
moveRaw(..., source: MapEventSource.doubleTapHold), but doubleTapHold isn't
in the switch, so fromSource returns null and no MapEvent is emitted
for the whole gesture.

The existing //! PREVENTS TILE LOADING IF SOURCE NOT CONFIGURED IN CONSTRUCTOR
comment in moveRaw points at exactly this gap.

Testing

  • Added test/map/map_events_test.dart, asserting fromSource(... source: doubleTapHold) returns a MapEventMove (with onMultiFinger as a baseline).

AI usage disclosure

  • I have identified regressive behaviour myself in the application I am developing, but I used Claude Code to find the cause of the bug and analyse the code for potential fixes.
  • Claude Code has been used to generate a test file
  • I have manually verified the solution myself in the application I am developing.

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