Skip to content

Defer click selection when starting area-select rectangle drag#3542

Open
nklbdev wants to merge 1 commit into
JannisX11:nextfrom
nklbdev:preview_clicks_as_complex_events
Open

Defer click selection when starting area-select rectangle drag#3542
nklbdev wants to merge 1 commit into
JannisX11:nextfrom
nklbdev:preview_clicks_as_complex_events

Conversation

@nklbdev
Copy link
Copy Markdown
Contributor

@nklbdev nklbdev commented May 2, 2026

Problem: When starting an area-select rectangle drag from the surface of a mesh element, mousedown immediately triggers a click that selects the element — before the drag even begins. This is especially disruptive when using Shift to extend selection: the unwanted element gets selected on mouse-down, and the rectangle then operates on a polluted selection state.

Fix: When the preview_area_select keybind triggers, normal click processing is skipped entirely. Control goes directly to startSelRect(). If the mouse is released without significant movement, the saved event is replayed as a deferred click via stopSelRect() — so single clicks still work as expected. A replaying_click flag on this.selection prevents the guard from intercepting the replay and blocks startSelRect from being called again from within the replayed click handler.

Flow:

Event Behavior
mousedown (area-select) Skip click, save deferred_event, call startSelRect
mousemove with rectangle activation Selection via viewportRectangleOverlap
mouseup (was drag) Undo.finishSelection('Area select')
mouseup (no drag) replaying_click = trueclick(deferred_event) → normal click processing

@nklbdev nklbdev changed the base branch from master to next May 2, 2026 15:14
@nklbdev nklbdev force-pushed the preview_clicks_as_complex_events branch from 27d145d to b4c667a Compare May 18, 2026 08:47
@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for blockbench-dev ready!

Name Link
🔨 Latest commit d7ea93b
🔍 Latest deploy log https://app.netlify.com/projects/blockbench-dev/deploys/6a10da8c54fd310008b15239
😎 Deploy Preview https://deploy-preview-3542--blockbench-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@nklbdev nklbdev force-pushed the preview_clicks_as_complex_events branch 2 times, most recently from 50533a7 to 23b01fc Compare May 18, 2026 20:24
@nklbdev nklbdev force-pushed the preview_clicks_as_complex_events branch from 23b01fc to d7ea93b Compare May 22, 2026 22:36
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.

1 participant