fix: dispatch mouseUp to the widget that received mouseDown - #846
Open
NemeZZiZZ wants to merge 1 commit into
Open
fix: dispatch mouseUp to the widget that received mouseDown#846NemeZZiZZ wants to merge 1 commit into
NemeZZiZZ wants to merge 1 commit into
Conversation
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
mouseDownEventremembers which widget received the press (this._mouseDownWidget = widget,Event.ts:312), butmouseUpEventignores it and re-hit-tests at the release position:The
mouseuplistener lives ondocumentElement, so releasing outside the chart still reaches this handler — but dispatches to whatever happens to be under the cursor (another pane's widget, an axis, the separator) or to nothing.Impact
Dragging an overlay point or continuous-drawing with the button released over an axis/separator: the main widget never gets its
mouseUpEvent, soOverlayView's mouse-up path (setPressedOverlayInfo({ overlay: null }),forceComplete()) never runs — the overlay stays pressed/unfinished until the next click on the main area.Fix
Standard mouse-capture semantics: dispatch
mouseUpEventto the widget that received themouseDownEvent, falling back to the hit-test only when no press is tracked:_makeWidgetEventthen also computes event-local coordinates against the widget that actually handles the event, which is correct under capture._mouseDownWidgetwas already tracked for the separator-drag path (Event.ts:387); this extends the same semantics to mouse-up.