Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

feat: highlight active tool or dialog in toolbar

Koschtetnix9bfd1158d05c
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index 3cbe33293e..96cab65d7e 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<String> = 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 {