From 9bfd1158d05c84d4bfe23b0782a9ada4625e4efc Mon Sep 17 00:00:00 2001 From: Koschtetnix Date: Sun, 11 Oct 2026 20:45:49 +0200 Subject: [PATCH] feat: highlight active tool or dialog in toolbar --- crates/ui-egui/src/toolbar.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 3cbe3329..96cab65d 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -332,6 +332,14 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) { } // Panels. let tab = app.ui.tab.clone(); + // The command whose tool or dialog is open right now, shown pressed in the toolbar. + let running: Option = match (&app.tool, &app.dialog) { + (Some(tool), _) => Some(tool.cmd.to_string()), + // Create Sketch never lands in last_command (it is not repeatable). + (None, Some(d)) if matches!(d.kind, crate::dialogs::Kind::Sketch) => Some("sketch.create".to_string()), + (None, Some(_)) => app.last_command.as_ref().map(|(id, _)| id.clone()), + _ => None, + }; let mut px = r.left() + 112.0; let top = r.top() + 26.0; let mut drop: Option<(&'static str, &'static str, Option<&'static str>)> = None; @@ -381,7 +389,9 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) { if resp.secondary_clicked() { menu = Some((resp.interact_pointer_pos().unwrap_or(br.left_bottom()), c.id)); } - if resp.hovered() && info.enabled { + if running.as_deref() == Some(c.id) { + painter.rect_filled(br, 4.0, t.border.gamma_multiply(0.7)); + } else if resp.hovered() && info.enabled { painter.rect_filled(br, 4.0, t.hover); } let (ink, fill, acc) = if info.enabled {