Browse Source

Demo: add button to reset the demo

pull/973/head
Emil Ernerfeldt 3 years ago
parent
commit
6185ee8ce4
  1. 2
      egui_demo_lib/src/apps/demo/demo_app_windows.rs
  2. 8
      egui_demo_lib/src/backend_panel.rs
  3. 17
      egui_demo_lib/src/wrap_app.rs

2
egui_demo_lib/src/apps/demo/demo_app_windows.rs

@ -232,7 +232,7 @@ fn show_menu_bar(ui: &mut Ui) {
ui.ctx().memory().reset_areas();
}
if ui
.button("Clear egui memory")
.button("Reset egui memory")
.on_hover_text("Forget scroll, positions, sizes etc")
.clicked()
{

8
egui_demo_lib/src/backend_panel.rs

@ -115,14 +115,6 @@ impl BackendPanel {
ui.label("egui windows:");
self.egui_windows.checkboxes(ui);
if ui
.button("Clear egui memory")
.on_hover_text("Forget scroll, positions, sizes etc")
.clicked()
{
*ui.ctx().memory() = Default::default();
}
ui.separator();
{

17
egui_demo_lib/src/wrap_app.rs

@ -93,6 +93,23 @@ impl epi::App for WrapApp {
if self.backend_panel.open || ctx.memory().everything_is_visible() {
egui::SidePanel::left("backend_panel").show(ctx, |ui| {
self.backend_panel.ui(ui, frame);
ui.separator();
ui.horizontal(|ui| {
if ui
.button("Reset egui")
.on_hover_text("Forget scroll, positions, sizes etc")
.clicked()
{
*ui.ctx().memory() = Default::default();
}
if ui.button("Reset everything").clicked() {
*self = Default::default();
*ui.ctx().memory() = Default::default();
}
});
});
}

Loading…
Cancel
Save