Skip to content

feat(core): one-finger double-tap-drag zoom gesture#10327

Open
charlieforward9 wants to merge 1 commit into
visgl:masterfrom
NEW-HEAT:codex/touch-double-tap-zoom
Open

feat(core): one-finger double-tap-drag zoom gesture#10327
charlieforward9 wants to merge 1 commit into
visgl:masterfrom
NEW-HEAT:codex/touch-double-tap-zoom

Conversation

@charlieforward9
Copy link
Copy Markdown
Collaborator

Adds Google Maps-style one-finger touch zoom: a quick tap followed by a press-and-drag with the same finger zooms continuously, without ever needing the second finger.

Change

  • New DOUBLE_TAP_DRAG event channel routed through pointerdown / pointermove / pointerup / pointercancel.
  • _onPointerDown promotes a stored single tap to a one-finger zoom session when the second tap lands within DOUBLE_TAP_DRAG_INTERVAL (500 ms) and DOUBLE_TAP_DRAG_MAX_TAP_DISTANCE (28 px).
  • _onPointerMove drives controllerState.zoom relative to vertical drag (DOUBLE_TAP_DRAG_PIXELS_PER_ZOOM = 120).
  • _onPointerUp finalizes the zoom and suppresses the trailing dblclick to avoid a doubled zoom-in.
  • Pan handlers short-circuit while a one-finger zoom is active to avoid mid-gesture pan/zoom interleaving.

Notes

  • Gated by touchZoom; works even with doubleClickZoom: false.
  • Tap-timing constants are empirical, chosen to feel snappy without false triggers — happy to tune if useful.
  • Split out from feat(core): improve touch zoom gestures #10303.

Tests

  • MapController supports double-tap drag zoom when double click zoom is disabled — exercises the full pointerdown → up → down → move → up sequence and asserts the camera zoomed in and didn't kick on release.

CI: vitest run --project browser test/modules/core/controllers/controllers.spec.ts.

Adds the Google Maps-style touch zoom: a quick tap followed by a
press-and-drag with the same finger zooms in/out continuously without
ever using the second finger. Useful for one-handed touch interaction.

- New DOUBLE_TAP_DRAG event channel routed through pointerdown/move/up.
- Tap timing constants tuned for snap response without false triggers.
- _onPointerDown promotes a stored single tap to a one-finger zoom
  session when the second tap lands close enough in time and space.
- _onPointerMove drives controllerState.zoom relative to vertical drag;
  _onPointerUp finalizes and suppresses the trailing dblclick.
- pan handlers short-circuit while a one-finger zoom is active.
@charlieforward9 charlieforward9 force-pushed the codex/touch-double-tap-zoom branch from 7cea955 to b1e6a61 Compare May 22, 2026 21:49
@coveralls
Copy link
Copy Markdown

Coverage Status

No base build to compare — NEW-HEAT:codex/touch-double-tap-zoom into visgl:master

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.

2 participants