Skip to content

fix(core): arm doubleClickDragZoom by coordinating the dblclickdrag recognizer#10417

Closed
charlieforward9 wants to merge 1 commit into
visgl:x/mjolnir-upfrom
NEW-HEAT:fix/doubleclickdrag-recognizer
Closed

fix(core): arm doubleClickDragZoom by coordinating the dblclickdrag recognizer#10417
charlieforward9 wants to merge 1 commit into
visgl:x/mjolnir-upfrom
NEW-HEAT:fix/doubleclickdrag-recognizer

Conversation

@charlieforward9

Copy link
Copy Markdown
Member

Problem

doubleClickDragZoom (added in #10327, enabled by the mjolnir.js 3.0.1 upgrade in this PR) never fires — a double-click-drag silently pans instead of zooming.

Cause

dblclickdrag was registered in RECOGNIZERS with no recognizeWith relationship. mjolnir's manager calls reset() on any non-active recognizer that can't recognize-with the currently active one. So the moment click/dblclick activate during the first tap, DoubleClickDrag's cross-tap memory (_lastTap) is wiped before the pointer-up is even processed. The second press then never matches a prior tap, the gesture never arms, and the drag falls through to pan.

Fix

Register dblclickdrag to recognize simultaneously with click/dblclick. Its tap memory survives the first tap; it then becomes the active recognizer on the second press, which also suppresses the competing pan (no zoom+pan jitter).

dblclickdrag: [DoubleClickDrag, {event: 'dblclickdrag'}, ['dblclick', 'click'], null]

Verification (headless pointer input)

  • Double-click-drag up → zooms 4.0 → 5.2, latitude drifts only monotonically (anchored-zoom pivot), no pan sawtooth.
  • Plain drag → still pans (lng changes, zoom unchanged).
  • Plain double-click → still zooms in one step.

cc @Pessimistress

🤖 Generated with Claude Code

…blclick

The DoubleClickDrag recognizer was registered with no recognizeWith
relationship, so mjolnir's manager called reset() on it as soon as the
click/dblclick recognizers activated during the first tap. That wiped its
cross-tap memory (_lastTap) before the pointer-up was processed, so the
second press never matched a prior tap and the gesture never armed --
doubleClickDragZoom silently fell through to pan.

Registering it to recognize simultaneously with click/dblclick keeps its
tap memory intact; it then becomes the active recognizer on the second
press, which also suppresses the competing pan (no more zoom+pan jitter).

Verified end-to-end via headless input: double-click-drag now zooms with
no pan drift, while plain drag still pans and plain double-click still
zooms one step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@charlieforward9

Copy link
Copy Markdown
Member Author

re-opening on same-repo PR

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 83.136%NEW-HEAT:fix/doubleclickdrag-recognizer into visgl:x/mjolnir-up. No base build found for visgl:x/mjolnir-up.

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