Defer click selection when starting area-select rectangle drag#3542
Defer click selection when starting area-select rectangle drag#3542nklbdev wants to merge 1 commit into
Conversation
27d145d to
b4c667a
Compare
✅ Deploy Preview for blockbench-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
50533a7 to
23b01fc
Compare
23b01fc to
d7ea93b
Compare
JannisX11
left a comment
There was a problem hiding this comment.
I'll take another look at the issue you described. But depending on keymap, the binding to click-select and the binding to area-select are both left mouse button, and this change moves the actual selection effectively to the mouseup event, which is not intended.
|
Yes, that's right. Event handling is delayed until the release. I still need to add my final local edit to this code: disabling this behavior for drawing tools. Otherwise, the behavior in this mode is extremely good and pleasant, and quite expected. It's quite possible that if you want to include this behavior in your release, you'll have to implement it slightly differently (you know best how to do it correctly). But overall, from UX perspective, this is very good. You can safely click a button and drag to select multiple faces of the current mesh without worrying that the click will be fully activated and select a face of a CLOSER, but not selected mesh. |
Problem: When starting an area-select rectangle drag from the surface of a mesh element,
mousedownimmediately 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_selectkeybind triggers, normal click processing is skipped entirely. Control goes directly tostartSelRect(). If the mouse is released without significant movement, the saved event is replayed as a deferred click viastopSelRect()— so single clicks still work as expected. Areplaying_clickflag onthis.selectionprevents the guard from intercepting the replay and blocksstartSelRectfrom being called again from within the replayed click handler.Flow:
mousedown(area-select)deferred_event, callstartSelRectmousemovewith rectangle activationviewportRectangleOverlapmouseup(was drag)Undo.finishSelection('Area select')mouseup(no drag)replaying_click = true→click(deferred_event)→ normal click processing