From a245ad2a6e2f4b8f5ef0c61574b4704d2c04f73d Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 24 Nov 2026 19:56:01 +0700 Subject: [PATCH] Contextual Task Bar: anchor conversions as icon buttons, as production (#9222) The Contextual Task Bar for direct-selected anchor points draws Convert Selected Anchor Points to Corner and to Smooth as icon buttons, named and tooltipped by their label, as production did (prod `canvas/task_bar.rs:953` `icon_only`). The port had spelled out both labels, which made the bar very long. Checks: `task_bar` and `tests::taskbar` tests 44 passed; clippy (`vectorcraft-ui-egui`, all targets, `-D warnings`) and `cargo fmt --check` are clean. --- crates/ui-egui/src/canvas/task_bar.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/ui-egui/src/canvas/task_bar.rs b/crates/ui-egui/src/canvas/task_bar.rs index 6710d631f2..5ec9e92382 100644 --- a/crates/ui-egui/src/canvas/task_bar.rs +++ b/crates/ui-egui/src/canvas/task_bar.rs @@ -471,6 +471,11 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, space: &CanvasSpac run = Some(("tool.setOption", json!({"tool": "smooth", "values": {"fidelity": x}}))); } } + } else if icon_only(cmd) { + // Convert to Corner and to Smooth show their icon alone, named by their label, as production's did. + if IconButton::new(IconSpec::svg(IconId::new(icon))).label(*label).show(ui).clicked() { + run = Some((*cmd, params.clone())); + } } else if Button::new(*label).variant(Variant::SECONDARY).icon(IconSpec::svg(IconId::new(icon))).show(ui).clicked() { run = Some((*cmd, params.clone())); } @@ -733,6 +738,11 @@ const TASK_BAR_DUPLICATE_ARTBOARDS: &str = "taskBar.duplicateArtboards"; /// The Contextual Task Bar's Rearrange All button with the Artboard tool. const TASK_BAR_REARRANGE_ARTBOARDS: &str = "taskBar.rearrangeArtboards"; +/// Whether the task bar shows the action `cmd` as its icon alone (its label names it and is its tooltip). +fn icon_only(cmd: &str) -> bool { + matches!(cmd, TASK_BAR_TO_CORNER | TASK_BAR_TO_SMOOTH) +} + /// The Contextual Task Bar's Convert Selected Anchor Points to Corner button, for direct-selected /// anchors or a path selected whole with Direct Selection. const TASK_BAR_TO_CORNER: &str = "taskBar.toCorner";