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

CentralPanel: base id on the current viewport #3593

Merged
merged 1 commit into from
Nov 20, 2023
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
2 changes: 1 addition & 1 deletion crates/egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ impl CentralPanel {
) -> InnerResponse<R> {
let available_rect = ctx.available_rect();
let layer_id = LayerId::background();
let id = Id::new("central_panel");
let id = Id::new((ctx.viewport_id(), "central_panel"));

let clip_rect = ctx.screen_rect();
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, available_rect, clip_rect);
Expand Down
4 changes: 1 addition & 3 deletions crates/egui_demo_lib/src/demo/extra_viewport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ impl super::Demo for ExtraViewport {
});
} else {
egui::CentralPanel::default().show(ctx, |ui| {
ui.push_id(id, |ui| {
viewport_content(ui, ctx, open);
})
viewport_content(ui, ctx, open);
});
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/test_viewports/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn show_as_popup(
// Not a real viewport
egui::Window::new(title).id(id).show(ctx, content);
} else {
egui::CentralPanel::default().show(ctx, |ui| ui.push_id(id, content));
egui::CentralPanel::default().show(ctx, content);
}
}

Expand Down
Loading