mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Viewports: give the caller a Ui instead of Context (#7779)
* Part of https://github.com/emilk/egui/issues/3524 This is a breaking change, as it changes the how embedded viewports work. Before it was up to the user to display a `egui::Window` if they wanted. Now egui creates an `egui::Window` for you, so you only need to add the contents. To signal this change in behavior, `ViewportClass::Embedded` is gone and is now called `ViewportClass::EmbeddedWindow`.
This commit is contained in:
@@ -22,17 +22,12 @@ impl crate::Demo for ExtraViewport {
|
||||
egui::ViewportBuilder::default()
|
||||
.with_title(self.name())
|
||||
.with_inner_size([400.0, 512.0]),
|
||||
|ctx, class| {
|
||||
if class == egui::ViewportClass::Embedded {
|
||||
|ui, class| {
|
||||
if class == egui::ViewportClass::EmbeddedWindow {
|
||||
// Not a real viewport
|
||||
egui::Window::new(self.name())
|
||||
.id(id)
|
||||
.open(open)
|
||||
.show(ctx, |ui| {
|
||||
ui.label("This egui integration does not support multiple viewports");
|
||||
});
|
||||
ui.label("This egui integration does not support multiple viewports");
|
||||
} else {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
viewport_content(ui, ctx, open);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e62836d9afa18cf4e486fe2819e652bf5df160026dc258201db0b99a75bdf7f1
|
||||
size 10125
|
||||
oid sha256:f5bc54f7829d1362ff13404103a8734a3cf739d63a5f812bad5e6beba57e73fe
|
||||
size 9510
|
||||
|
||||
Reference in New Issue
Block a user