-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Check cursor position for out of bounds of the window #8855
Conversation
It is said in #8840 that the event is correctly fired from winit. If that's the case, could you try and fix the bug where it's not setting the position to None instead of adding bound checks? |
Check out my latest comment: #8840 (comment) EDIT: We could solve this without bounds checks, by storing a boolean for 'is cursor within this window', which is updated on cursor entered and left events. Then we could ignore new cursor positions if the cursor isn't within the window. |
Tbh I think moving the bounds checking to the setting of physical position would be the best bet here. That way even user setting of physical cursor position doesn't give weird results. |
Actually hmm, maybe doing this on |
Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
Should this maybe be an optional feature? E.g. a boolean argument |
I don't think so tbh. I'd be fine with adding a cursor_position_unchecked, but I don't see the use case for it. The oob cursors are highly inconsistent and prob shouldn't be relied on here. |
# 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 <david.curthoys@googlemail.com>
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
None
when outside of the window.