Repository navigation
fix(core): arm doubleClickDragZoom by coordinating the dblclickdrag recognizer - #10418
Merged
Merged
Conversation
…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 <[email protected]>
charlieforward9
force-pushed
the
fix/doubleclickdrag-recognizer
branch
from
July 3, 2026 19:34
2453242 to
bd9a266
Compare
chrisgervang
added a commit
that referenced
this pull request
Jul 10, 2026
* upgrade mjolnir.js * fix(core): register dblclickdrag recognizer to recognize with click/dblclick (#10418) Co-authored-by: Claude Opus 4.8 <[email protected]> * fix(core): eliminate 300ms click delay and fix runtime controller prop changes (#10422) * fix(core): disable doubleClickZoom by default to eliminate 300ms click delay The click recognizer's requireFailure dependency on dblclick causes mjolnir.js to defer click events by 300ms. Disabling doubleClickZoom by default removes this delay while keeping doubleClickDragZoom available for zoom-by-drag gestures. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(core): also disable doubleClickDragZoom by default Same principle — once #10416 lands, dblclickdrag should be in click's requireFailure list to prevent spurious clicks before a drag-zoom. That would reintroduce the 300ms delay, so disable by default too. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(core): add dblclickdrag to click's requireFailure list Prevents spurious click events from firing before a double-click-drag zoom gesture is recognized. Without this, a click would emit on the first tap before the recognizer determines the user intends to drag. Co-Authored-By: Claude Opus 4.6 <[email protected]> * test(core): add click delay unit tests for controller gesture config Tests verify through the full EventManager → recognizer pipeline that: - Click fires immediately when doubleClickZoom and doubleClickDragZoom are both disabled (the new default) - Click is delayed ~300ms when doubleClickZoom is enabled - Click is delayed ~300ms when doubleClickDragZoom is enabled Also reorders RECOGNIZERS so dblclickdrag is registered before click, which is required for click's requireFailure reference to resolve. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(core): ensure dblclick recognizer is disabled when doubleClickZoom is false The dblclick/dblclickdrag recognizers start with enable:false so they don't cause the 300ms click delay out of the box. Deck's picking system uses watch() (passive) for the dblclick event so it doesn't force-enable the recognizer. Only the controller's doubleClickZoom option enables it. Also adds integration tests that verify click latency at the Deck level using real pointer events dispatched to the canvas. Co-Authored-By: Claude Opus 4.6 <[email protected]> * test(core): fix dblclick integration tests using direct pointer dispatch The dblclick tests were broken because page.mouse.dblclick() doesn't properly target the canvas inside vitest's browser iframe. Fixed by dispatching PointerEvents directly on the canvas element, matching how mjolnir's PointerEventInput listener works (pointerdown on element, pointerup on window). Each test uses a fresh Deck instance for isolation. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(core): propagate runtime controller prop changes to ViewManager Deck._getViews() was mutating the View instance's props.controller in-place, so ViewManager._diffViews short-circuited on identity (same object) and never triggered _rebuildViewports. Controller option changes via setProps had no effect at runtime. Fixed by cloning the view when applying the controller prop. Also adds a gesture-timing test app that measures event handling delays and demonstrates the ~300ms click latency tradeoff with doubleClickZoom. - Restore doubleClickZoom=true default (breaking change avoidance) - Add regression test for runtime controller prop propagation - Add test/apps/gesture-timing for interactive delay measurement Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]> * docs(core): document onClick(tapCount=2) side-effect of doubleClickZoom Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Charles Richardson <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Chris Gervang <[email protected]> Co-authored-by: Chris Gervang <[email protected]>
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.
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
dblclickdragwas registered inRECOGNIZERSwith norecognizeWithrelationship. mjolnir's manager callsreset()on any non-active recognizer that can't recognize-with the currently active one. So the momentclick/dblclickactivate 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 topan.Fix
Register
dblclickdragto recognize simultaneously withclick/dblclick. Its tap memory survives the first tap; it then becomes the active recognizer on the second press, which also suppresses the competingpan(no zoom+pan jitter).Verification (headless pointer input)
4.0 → 5.2, latitude drifts only monotonically (anchored-zoom pivot), no pan sawtooth.cc @Pessimistress
🤖 Generated with Claude Code