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: Only Resize WebView Associated With Window #3584

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/desktop/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ impl App {
}
}

pub fn resize_window(&self, size: PhysicalSize<u32>) {
pub fn resize_window(&self, id: WindowId, size: PhysicalSize<u32>) {
// TODO: the app layer should avoid directly manipulating the webview webview instance internals.
// Window creation and modification is the responsibility of the webview instance so it makes sense to
// encapsulate that there.
self.webviews.values().for_each(|webview_instance| {
if let Some(webview) = self.webviews.get(&id) {
use wry::Rect;

webview_instance
webview
.desktop_context
.webview
.set_bounds(Rect {
Expand All @@ -244,7 +244,7 @@ impl App {
)),
})
.unwrap();
});
}
}

pub fn handle_start_cause_init(&mut self) {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn launch_virtual_dom_blocking(virtual_dom: VirtualDom, mut desktop_config:
} => match event {
WindowEvent::CloseRequested => app.handle_close_requested(window_id),
WindowEvent::Destroyed { .. } => app.window_destroyed(window_id),
WindowEvent::Resized(new_size) => app.resize_window(new_size),
WindowEvent::Resized(new_size) => app.resize_window(window_id, new_size),
_ => {}
},

Expand Down
Loading