Demo: add button to reset the demo
This commit is contained in:
parent
5d463b2af7
commit
6185ee8ce4
3 changed files with 18 additions and 9 deletions
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
||||
{
|
||||
|
|
|
@ -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…
Reference in a new issue