-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Window.cursor_position
can return Some
when it shouldn't
#8840
Comments
Just noticed this as well, put in a fix for it. |
After a little more digging, I've discovered the problem is that sometimes a This feels like a winit bug after all, since the out-of-order events are coming from there. |
# Objective Fixes #8840 Make the cursor position more consistent, right now the cursor position is *sometimes* outside of the window and returns the position and *sometimes* `None`. Even in the cases where someone might be using that position that is outside of the window, it'll probably require some manual transformations for it to actually be useful. ## Solution Check the windows width and height for out of bounds positions. --- ## Changelog - Cursor position is now always `None` when outside of the window. --------- Co-authored-by: ickshonpe <[email protected]>
# Objective Fixes bevyengine#8840 Make the cursor position more consistent, right now the cursor position is *sometimes* outside of the window and returns the position and *sometimes* `None`. Even in the cases where someone might be using that position that is outside of the window, it'll probably require some manual transformations for it to actually be useful. ## Solution Check the windows width and height for out of bounds positions. --- ## Changelog - Cursor position is now always `None` when outside of the window. --------- Co-authored-by: ickshonpe <[email protected]>
Bevy version
0.10.1
What you did
Called the
Window.cursor_position
method after moving mouse from one window to another.What went wrong
It intermittently returns
Some(...)
when it should beNone
.Additional information
Using the small app below, this video shows the issue clearly. You can see that sometimes, but not always, when moving the cursor from one window directly to another window, the first window still thinks it has the cursor. This results in multiple windows claiming they have the cursor, while only one can at any one time.
I can see here Bevy sets the cursor position to
None
when it sees aWindowEvent::CursorLeft
event from winit, but I verified that it is fired every time, even when the issue occurs, so I don't believe this is a bug in winit.Screen.Recording.2023-06-14.at.7.26.15.pm.mov
Minimal app:
The text was updated successfully, but these errors were encountered: