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.
This commit is contained in:
BFlat
2026-11-24 19:56:01 +07:00
committed by GitHub
parent 18d2939ffc
commit a245ad2a6e
+10
View File
@@ -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";