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

Use correct canvas size for scale factor change #2849

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

daxpedda
Copy link
Member

@daxpedda daxpedda commented Jun 4, 2023

Until now the internal canvas size was used to determine it's current size, even when calculating the new size on a scale factor change, which was kind of problematic already as discussed in #2778.

This PR change that to track the canvas size we set in Winit, so we can use it for recalculations and to report to the user what we set it to when calling Window::inner_size().

I briefly explore if it would be possible to query it instead of having to track it, unfortunately there is no reliable way through JS to track the CSS width and height we set ourselves. The closest is getComputedStyle(), which has it's own set of problems, among them the fact that it will always return zero until the canvas is actually inserted into the window.

Related #2778.
Fixes #2524.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Web: Canvas dimensions not correct initially.
1 participant