-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handle releasing mouse buttons when not hovering a window #121
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for the PR.
Is the goal here to fix the behaviour for any platform? I believe this branch will be entered only for Safari, as this is the only browser that emits
CursorLeft
andCursorEntered
on mouse button release.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems off since this change fixed unexpected behavior on desktop linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, this branch needs to be possible to entered on all platforms - after all it's the only branch where
mouse_position
is reset.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm.. I'm not sure it's working as intended. If I keep dragging the mouse pointer and it leaves the window, it'll fire the release button event immediately (as demonstrated in the video). Yet in the
main
version we keep reading mouse events when outside of a window, which allows us to continue dragging sliders for example (see #61).Screen.Recording.2022-09-17.at.11.50.24.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not sure I understand what issue the PR is trying to address (or whether the issue indeed exists).
During this recording (the
main
branch), I dragged the cursor outside of the window, released it when being outside, moved the cursor back to the window, and we can see thatbevy_egui
didn't continue drawing to the canvas. If I understand correctly, your point is that we don't fire mouse release events when releasing the cursor outside of the window. But if that was the case, wouldn't it keep drawing when I moved the cursor back to the window?Screen.Recording.2022-09-17.at.11.56.30.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I just tested the main branch - the drawing continues when i release the button outside the window and move the cursor back in. Perhaps the issue doesn't happen on macs for one reason or another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
egui-show-bug-.webm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, thanks for clarifying. I was indeed able to reproduce it on my KDE laptop.
Turns out, for some platforms,
winit
firesCursorLeft
together with button input events when releasing a button outside of a window. I've just pushed #123 with the fix that also preserves the dragging behaviour. Could you please test it and let me know if it works for you?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to work :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged and released. Thanks again for flagging it!