feat(core): one-finger double-tap-drag zoom gesture#10327
Open
charlieforward9 wants to merge 1 commit into
Open
feat(core): one-finger double-tap-drag zoom gesture#10327charlieforward9 wants to merge 1 commit into
charlieforward9 wants to merge 1 commit into
Conversation
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.
7cea955 to
b1e6a61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DOUBLE_TAP_DRAGevent channel routed throughpointerdown/pointermove/pointerup/pointercancel._onPointerDownpromotes a stored single tap to a one-finger zoom session when the second tap lands withinDOUBLE_TAP_DRAG_INTERVAL(500 ms) andDOUBLE_TAP_DRAG_MAX_TAP_DISTANCE(28 px)._onPointerMovedrivescontrollerState.zoomrelative to vertical drag (DOUBLE_TAP_DRAG_PIXELS_PER_ZOOM = 120)._onPointerUpfinalizes the zoom and suppresses the trailingdblclickto avoid a doubled zoom-in.Notes
touchZoom; works even withdoubleClickZoom: false.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.