Skip to content

Commit

Permalink
Demo app: handle the case of wrong selected anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 21, 2022
1 parent c3fc899 commit b360dff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions egui_demo_lib/src/wrap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,19 @@ impl epi::App for WrapApp {
});
}

let mut found_anchor = false;

for (anchor, app) in self.apps.iter_mut() {
if anchor == self.selected_anchor || ctx.memory().everything_is_visible() {
app.update(ctx, frame);
found_anchor = true;
}
}

if !found_anchor {
self.selected_anchor = "demo".into();
}

self.backend_panel.end_of_frame(ctx);

self.ui_file_drag_and_drop(ctx);
Expand Down

0 comments on commit b360dff

Please sign in to comment.