1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 21:00:03 -04:00

Remove id from ViewportBuilder so it can implement Default

This commit is contained in:
Emil Ernerfeldt
2023-11-14 19:52:28 +01:00
parent 09a728ba34
commit 54f6e6b9ae
6 changed files with 94 additions and 81 deletions

View File

@@ -28,10 +28,13 @@ impl eframe::App for MyApp {
ui.checkbox(&mut self.show_child_viewport, "Show secondary viewport");
});
let mut viewport = egui::ViewportBuilder::CHILD;
viewport.with_title("Secondary Viewport");
if self.show_child_viewport {
ctx.show_viewport(
egui::ViewportBuilder::new(egui::ViewportId::from_hash_of("secondary_viewport"))
.with_title("Secondary Viewport"),
egui::ViewportId::from_hash_of("secondary_viewport"),
viewport,
|ctx| {
egui::CentralPanel::default().show(ctx, |ui| {
ui.label("Hello from secondary viewport");