1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Change arguments to animating panel functions to take &mut bool

This commit is contained in:
Emil Ernerfeldt
2025-06-18 19:39:29 -07:00
parent bd97a93643
commit 623dc149f0
2 changed files with 90 additions and 49 deletions

View File

@@ -337,14 +337,13 @@ impl WrapApp {
fn backend_panel(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) -> Command {
// The backend-panel can be toggled on/off.
// We show a little animation when the user switches it.
let is_open =
self.state.backend_panel.open || ctx.memory(|mem| mem.everything_is_visible());
let mut cmd = Command::Nothing;
let mut open = self.state.backend_panel.open;
egui::SidePanel::left("backend_panel")
.resizable(false)
.show_animated(ctx, is_open, |ui| {
.show_animated(ctx, &mut open, |ui| {
ui.add_space(4.0);
ui.vertical_centered(|ui| {
ui.heading("💻 Backend");
@@ -354,6 +353,8 @@ impl WrapApp {
self.backend_panel_contents(ui, frame, &mut cmd);
});
self.state.backend_panel.open = open;
cmd
}