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

fix: sync size of window and viewport #1437

Merged
merged 3 commits into from
Sep 20, 2022
Merged

Conversation

wash2
Copy link
Contributor

@wash2 wash2 commented Sep 11, 2022

I noticed that iced::window::resize did change the size of the window, but didn't sync with the viewport size, like how a user resize would. This syncs the size of the window and viewport.

@hecrj hecrj added bug Something isn't working shell labels Sep 14, 2022
@hecrj hecrj added this to the 0.5.0 milestone Sep 14, 2022
@hecrj
Copy link
Member

hecrj commented Sep 14, 2022

Interesting... I figured this branch in the update logic would deal with it:

WindowEvent::Resized(new_size) => {
let size = Size::new(new_size.width, new_size.height);
self.viewport = Viewport::with_physical_size(
size,
window.scale_factor() * self.scale_factor,
);
self.viewport_version = self.viewport_version.wrapping_add(1);
}

But maybe resizing through the Window API does not trigger a Resized event in winit?

@wash2
Copy link
Contributor Author

wash2 commented Sep 14, 2022

But maybe resizing through the Window API does not trigger a Resized event in winit?

Ya that seemed to be the case. I can look into making an issue / PR at winit for it as well.

@hecrj
Copy link
Member

hecrj commented Sep 20, 2022

@wash2 That would be great!

@hecrj
Copy link
Member

hecrj commented Sep 20, 2022

Thank you 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants