Fix the wgpu child window example (#3989)

This commit is contained in:
Christian Wyglendowski authored and GitHub committed 2025-04-16 08:40:56 -07:00
1 parent 1001d78c7f
commit a9468429d7
1 file changed
+10 -7
+10 -7
View File
@@ -52,12 +52,15 @@ fn app() -> Element {
} = event } = event
{ {
let ctx = graphics_resources.value(); let ctx = graphics_resources.value();
ctx.as_ref().unwrap().with_resources(|srcs| { if let Some(ctx_ref) = ctx.as_ref() {
let mut cfg = srcs.config.clone(); ctx_ref.with_resources(|srcs| {
cfg.width = new_size.width; let mut cfg = srcs.config.clone();
cfg.height = new_size.height; cfg.width = new_size.width;
srcs.surface.configure(&srcs.device, &cfg); cfg.height = new_size.height;
}); srcs.surface.configure(&srcs.device, &cfg);
});
}
window().window.request_redraw(); window().window.request_redraw();
} }
}); });
@@ -71,7 +74,7 @@ fn app() -> Element {
justify_content: "center", justify_content: "center",
align_items: "center", align_items: "center",
font_size: "20px", font_size: "20px",
div { "text overlaied on wgpu surface!" } div { "text overlaid on a wgpu surface!" }
} }
} }
} }