-
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
Conversation
if let Some(window_id) = &cursor_left_window { | ||
if cursor_left_window != cursor_entered_window { |
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
and CursorEntered
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 that bevy_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
fires CursorLeft
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!
No description provided.