Repository navigation
feat(core): upgrade mjolnir.js for DoubleClickDrag recognizer - #10416
Merged
Merged
Conversation
…blclick (#10418) Co-authored-by: Claude Opus 4.8 <[email protected]>
chrisgervang
approved these changes
Jul 3, 2026
chrisgervang
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the cleanup!
7 tasks done
Collaborator
|
The click: [Tap, {event: 'click'}, null, ['dblclick', 'dblclickdrag']]I think it should be in the list to avoid spurious clicks, and then if we agree on prioritizing responsiveness, I'd consider disabling it by default along the same lines as #10422. |
chrisgervang
added a commit
that referenced
this pull request
Jul 4, 2026
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]>
chrisgervang
added a commit
that referenced
this pull request
Jul 4, 2026
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]>
…p 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]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
12 tasks done
chrisgervang
added a commit
that referenced
this pull request
Oct 29, 2026
…kZoom is off (#10384) (#10973) * fix(core): remove the 300ms click delay when doubleClickZoom is off (#10384) Backport of the click-delay part of #10422 (merged into master via #10416) to 9.3-release, without the DoubleClickDrag recognizer. - The dblclick recognizer starts disabled, and Deck watches dblclick for picking, so only the controller's doubleClickZoom option enables it - Clone the view when the controller prop changes so runtime changes apply - Interaction tests; they read the protected eventManager field because Deck.getEventManager() isn't on 9.3 * fix(core): copy the views array before applying the controller prop Cloning the first view wrote into the caller's views array, which throws when the array is frozen. * test(core): keep the frozen views array typed as View[]
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.
Summary
Upgrades mjolnir.js to v3.0.1 and replaces the controller's hand-rolled pointer/tap logic for double-click-drag zoom with mjolnir's
DoubleClickDragrecognizer. Also fixes a bug where runtimecontrollerprop changes viadeck.setProps()had no effect.Changes
mjolnir.js upgrade
^3.0.1which provides theDoubleClickDragrecognizerdblclickdragstart,dblclickdragmove,dblclickdragend)Recognizer wiring (
constants.ts)dblclickanddblclickdragrecognizers disabled by default (enable: false)dblclickdragto click'srequireFailurelist (prevents spurious clicks before drag-zoom)Click latency fix (
deck.ts)watch()(passive) for dblclick in Deck's picking registration so the picking system doesn't force-enable the recognizer_getViews()instead of mutating props in-place, fixing runtime controller prop propagationController defaults (
controller.ts)doubleClickDragZoomdefaults tofalse(new feature, opt-in)doubleClickZoomremainstrue(existing behavior preserved)Tests
test/apps/gesture-timingapp for measuring event delaysLatency tradeoff
When
doubleClickZoomordoubleClickDragZoomis enabled, the click recognizer'srequireFailuredependency forces a ~300ms wait before emitting click (to rule out double-click). Settingcontroller: {doubleClickZoom: false}gives immediate clicks. This also disablesonClick(tapCount=2)for double-click picking (PR #9629).Test plan
How to test
Click the map → observe event log. Toggle
doubleClickZoomor use preset buttons to see click latency change in real-time.Generated with Claude Code
Note
Medium Risk
Touches core viewport gesture recognition and changes default double-click-drag behavior; mis-wired recognizers or the view-clone fix could affect click timing and controller updates at runtime.
Overview
Upgrades mjolnir.js to
^3.0.1and moves double-click-drag zoom out of hand-rolledpointer*handling inControllerinto mjolnir’sDoubleClickDragevents (dblclickdragstart/move/end/cancel), usingevent.scalefor zoom.Recognizer setup in
constants.tsregistersdblclickanddblclickdragdisabled by default, wiresclicktorequireFailureon those recognizers, and documents registration order.doubleClickDragZoomnow defaults tofalseinsetProps(opt-in). Docs call out the ~300ms single-click delay whendoubleClickZoomordoubleClickDragZoomis on, and that turning offdoubleClickZoomdropsonClickwithtapCount: 2.Deck registers
dblclickviawatch()for picking so the picking path doesn’t always enable the double-click recognizer, and_getViews()clones the view when applying the legacycontrollerprop so runtimedeck.setProps({ controller })updates actually propagate.Adds integration/unit coverage for click delay and runtime toggles, plus a
test/apps/gesture-timingdev app to visualize latency.Reviewed by Cursor Bugbot for commit 551130d. Bugbot is set up for automated code reviews on this repo. Configure here.