Skip to content
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

Include window scale factor in viewport offset calculation #92

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

bardt
Copy link
Contributor

@bardt bardt commented Sep 28, 2023

When working with bevy_mod_picking I noticed that pick events are not triggered when I work with a viewport positioned with an offset relative to the window. I tracked issue down to this package. One can reproduce the issue by running mouse_picking example on a high density display: the rays will not match with mouse cursor.

Turns out, the viewport offset calculation doesn't take into account pixel density of the screen. We have access to this information in Window though. So I make an assumption that we are working with the primary window, and pass the object down to the offset calculation.

I also borrowed helper code for low_latency_window_plugin from bevy_mod_picking while at it.

This PR fixes one of the root issues #91 tried to fix symptoms for.

Closes #93

@aevyrie aevyrie merged commit 65037f5 into aevyrie:main Oct 4, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Viewport offset ignores window scale factor
2 participants