Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So since #2778 properly decoupling internal and visual canvas size, we should make things consistent.
Before (#2778)
Using
Window::set_inner_size()
would apply physical pixels to the internal canvas size and logical pixel to the visual canvas size. The logical pixel would be applied to the canvas size as physical pixels by setting CSS width and height aspx
values.E.g.:
Window::set_inner_size(PhysicalSize::new(500, 500))
with a scale factor of 2. Would apply 500x500px to the the internal canvas size and 250x250px to the visual size.Window::inner_size()
would report a size of 500x500px.In the meanwhile the reported size by
Window::inner_size()
would be theCurrently (after #2778)
Same as before, but it would only apply the visual size, internal size wouldn't be touched at all.
After (this PR)
Window::set_inner_size()
will apply the correct size to the canvas. E.g.Window::set_inner_size(PhysicalSize::new(500, 500))
will apply 500x500px to the visual size of the canvas, no matter the current scale factor.