brush: fix brush jumping around after mouseup #1836
Merged
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.
🐛 Bug Fix
How to induce?
resize the brush window by dragging and releasing one handle quickly, or quickly drag the brush window and release (harder to induce this way)
Impact?
Handle ends up quite far away from the mouse pointer's location. Sometimes the location of both handles will be updated, resulting in a drastic resize of the brush window.
Two relevant issue have been linked below- I believe this PR should resolve both of them!
Issue 1
Issue 2
Root cause
mouseup
action is supposed to disable subsequent dragging of the handle uponmousemove
. This is achieved by updating the brush's state. However, when moving quickly,mousemove
actions can triggerhandleWindowPointerMove
before the state change is complete. This leads to handle movement aftermouseup
. Additionally, the stale state causes the occasionally erratic placement of the handle(s).Before
Screen.Recording.2024-05-21.at.3.08.32.PM.mov
After
Can't induce the bug anymore, even with very quick use of the brush.
Screen.Recording.2024-05-21.at.3.12.11.PM.mov