-
-
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
Window scale_factor_override() doesn't affect cursor position #2501
Comments
I've attached an example program (I couldn't upload a .rs file so I copied it to a .txt file). If you don't have a font installed you can tell when the button is selected by the colour changing. Also, I have it printing out the cursor's location, to show that it doesn't match up with the actual size of the window. |
Doing a bit of digging, this issue seems like it might have promising breadcrumbs from winit, our upstream dependency for windowing: rust-windowing/winit#1491 Now, let's track how cursor position is set...
We have access to the scale factor information in that function already; it looks like it's just a matter of adding a multiplication step just above L315 (and adding some tests). |
Sometimes the wrong scale factor was used (not accounting for overrides). Fixes bevyengine#2501
# Objective - Fixes bevyengine#2501 - Builds up on bevyengine#2639 taking bevyengine#2639 (comment) into account ## Solution - keep the physical cursor position in `Window`, and expose it. - still convert to logical position in event, and when getting `cursor_position` Co-authored-by: Ahmed Charles <[email protected]>
# Objective - Fixes bevyengine#2501 - Builds up on bevyengine#2639 taking bevyengine#2639 (comment) into account ## Solution - keep the physical cursor position in `Window`, and expose it. - still convert to logical position in event, and when getting `cursor_position` Co-authored-by: Ahmed Charles <[email protected]>
Bevy version
0.5
Operating system & version
Windows 10
What you did
Because my screen has a high DPI and scales applications to 125%, I created a window with scale_factor_override: Some(1.0). I also added a button in the middle of the window.
What you expected to happen
The window will display at 100% scale (rather than 125%) and the cursor's position will update accordingly.
What actually happened
While the window did display correctly at 100% scale, the cursor position seems to still behave as if it was scaled to 125%. To click on the button, I had to click above and to the right of the button, and when I printed out the cursor position the top right corner's position was (480, 360) rather than the actual size of the window, (640, 480).
The text was updated successfully, but these errors were encountered: