Skip to content

Adapters: stop reporting a finished drawing's clicks as map clicks - #352

Open
CarsonDavis wants to merge 1 commit into
developmentfrom
feature/351-draw-end-clicks
Open

Adapters: stop reporting a finished drawing's clicks as map clicks#352
CarsonDavis wants to merge 1 commit into
developmentfrom
feature/351-draw-end-clicks

Conversation

@CarsonDavis

Copy link
Copy Markdown
Collaborator

Stops both map engines from reporting a finished drawing's own clicks as ordinary map clicks, by timing the clicks a finishing gesture can still produce and holding them back until they have all arrived.

Closes #351

What this changes

  • The phantom click is gone. terra-draw commits a shape on pointerup, but the click of that same gesture reaches the engine afterwards — Leaflet on the native click that trails it, deck.gl a tap interval later, since its click recognizer waits to rule out a double-click. Both land with the session already over, so the adapters' "am I drawing?" check no longer covers them. The two things a user saw for it: finishing a drawing silently deselected their active feature, and anything a plugin opened in response to drawcomplete was dismissed a moment later by a click that never happened.

  • A time-based guard, not a counted one. DrawPointerWatch tracks the pointer a session ends on; DrawEndClickGuard covers the clicks that pointer can still produce. The window is timed off hammer's 300ms tap interval — the one number every click deck delivers is measured against — and each pointerup inside it re-opens the window for a settle period, long enough for the latest click the gesture can yield. It closes early too: a pointerdown too late to be the second tap of a double-click is the user starting a gesture of their own, and the window closes there and then rather than eating their click. A session that ends with no pointer that recent — Enter pressed while reading the shape back, a plugin's own Finish button — opens no window at all.

  • Leaflet's clicks now funnel through one listener. Click subscribers registered through on() hang off an adapter-owned map listener instead of off Leaflet directly, so the drawing session is checked once, where clicks are reported, rather than at every subscription. That is the shape DeckGLAdapter's pointer-click path already had; _onPointerClick/_onPointerHover are extracted there so both wiring modes share one copy. Map_.js's feature-deselect handler moves onto the engine click path so it inherits the guard.

  • A double-click finish no longer zooms the map. terra-draw turns double-click zoom back on the instant the mode stops, which would let the finishing gesture's second tap zoom on top of everything else it does. The guard holds that re-enable back for as long as it is absorbing the same gesture's clicks, and gives back the state the map actually had — a deployment that configures double-click zoom off keeps it off.

#303 stacks on this: the popup service's click-away dismissal is what made the phantom click visible, and depends on this guard to not close a card the moment it opens.

terra-draw commits a shape on `pointerup`, but the click of that same
gesture reaches the engine only afterwards — Leaflet on the native `click`
that follows, deck.gl a tap interval later, since its `click` recognizer
waits to see whether a double-click is coming. Both land with the session
already over, so the adapters' "am I drawing?" check no longer covers them
and every consumer is handed a map click the user never made: one that
arrives after `drawcomplete` and clears the selection or dismisses whatever
a plugin just opened.

A time-based guard closes that gap. `DrawPointerWatch` tracks the pointer a
session ends on, and `DrawEndClickGuard` holds back the clicks that pointer
can still produce — through both taps of a double-click finish, holding
terra-draw's double-click-zoom re-enable back with them, and closing early
the moment the user opens a gesture of their own. Leaflet's click
subscribers now fan out from one adapter-owned map listener, so the session
is checked once where clicks are reported, the shape DeckGLAdapter's pointer
path already had.
@CarsonDavis CarsonDavis linked an issue Aug 27, 2026 that may be closed by this pull request
5 tasks
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.

Adapters: stop reporting a finished drawing's clicks as map clicks

1 participant