Tool icons: tools on a generic icon get one that shows what the tool does (#9032)
No files matched your search
@@ -143,12 +143,14 @@ Generated-in-code art is original and has no file to list. This covers the defau
|
||||
| `assets/icons/dc-arrow-fill.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | The Selection and Direct Selection arrows' fill, painted black or white under their outline |
|
||||
| `assets/icons/dc-arrow-tip.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-arrow-up.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-artboard.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-artboard-options.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-artboards.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-blend.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-blend-align-page.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-blend-align-path.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-bloat.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-blob-brush.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-cap-butt.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-cap-round.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-cap-square.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
@@ -227,6 +229,7 @@ Generated-in-code art is original and has no file to list. This covers the defau
|
||||
| `assets/icons/dc-live-select.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-mask-none.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-measure.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-measure-inspect.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-mesh.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-mirror-cut.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-new-fill.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
@@ -245,6 +248,7 @@ Generated-in-code art is original and has no file to list. This covers the defau
|
||||
| `assets/icons/dc-para-numbers.svg` | VectorCraft contributors | Original work, drawn for VectorCraft: the digits 1, 2 and 3, each before a line | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-para-right.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-para-rtl.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-parametric-shape.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-path-eraser.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-pathfinder.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-perspective-select.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
@@ -262,32 +266,38 @@ Generated-in-code art is original and has no file to list. This covers the defau
|
||||
| `assets/icons/dc-place-symbol.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-polar-grid.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-polygon.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-print-tiling.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-pucker.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-puppet.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-quick-pen.svg` | VectorCraft contributors | Original work, drawn for VectorCraft (a line and a half circle with a dot at each point) | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rearrange.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-recolor-arrow.svg` | VectorCraft contributors | Original work, drawn for VectorCraft (a right arrow, a Recolor Artwork row that is recolored) | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-recolor-arrow-off.svg` | VectorCraft contributors | Original work, drawn for VectorCraft (a dashed line without a head, a Recolor Artwork row that is excluded) | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rect.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rect-cut.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rect-grid.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-reference-point.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-remove-brush.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-reshape.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-reverse.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rotate.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rotate-view.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rounded-rect.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rule-evenodd.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-rule-nonzero.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-scale.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-scallop.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-screen-mode.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-selection.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-shape-builder.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-shaper.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-shared-edge.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-shear.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-slice-select.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-slice.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-slide-anchor.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-smooth.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-spiral.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-stroke-center.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-stroke-inside.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-stroke-outside.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
@@ -305,6 +315,7 @@ Generated-in-code art is original and has no file to list. This covers the defau
|
||||
| `assets/icons/dc-symbol-sprayer.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-symbol-stainer.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-symbol-styler.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-tangent-circle.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-touch-type.svg` | VectorCraft contributors (designed by ham9zah) | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-transform-panel.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-transparency.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
@@ -315,6 +326,7 @@ Generated-in-code art is original and has no file to list. This covers the defau
|
||||
| `assets/icons/dc-type-vertical.svg` | VectorCraft contributors (designed by ham9zah) | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-type-vertical-area.svg` | VectorCraft contributors (designed by ham9zah) | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-type-vertical-path.svg` | VectorCraft contributors (designed by ham9zah) | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-warp.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-width-profile.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-width.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
| `assets/icons/dc-wrinkle.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="6" width="12" height="12"/><path d="M6 2v2M2 6h2M18 22v-2M22 18h-2"/></svg>
|
||||
|
After Width: | Height: | Size: 274 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 3.5 14.75 9.25"/><path d="M13 7.5l3.5 3.5-3 3c-1 1-2.75 1-3.75 0s-1-2.75 0-3.75z"/><path d="M10.2 14.2C8.5 15.5 6 15 4.5 16.5S3.5 20.5 6 20.5 8.5 19 10 19.5s3.5-1 2.5-3-1.5-1.7-2.3-2.3z" fill="currentColor"/></svg>
|
||||
|
After Width: | Height: | Size: 413 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="8.5" r="5"/><path d="M13.5 12 17 15.5"/><path d="M3 20h18M4 20v-3.5M8 20v-2M12 20v-3.5M16 20v-2M20 20v-3.5"/></svg>
|
||||
|
After Width: | Height: | Size: 319 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.5 L19.5 8 L19.5 16 L12 20.5 L4.5 16 L4.5 8 Z"/><path d="M8 12h8"/><circle cx="13.5" cy="12" r="1.8" fill="currentColor"/></svg>
|
||||
|
After Width: | Height: | Size: 326 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="6" width="12" height="12"/><path d="M6 2v2M2 6h2M18 22v-2M22 18h-2"/><rect x="11" y="2.5" width="9" height="11.5" stroke-dasharray="2 2"/></svg>
|
||||
|
After Width: | Height: | Size: 343 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="5" width="16" height="14"/></svg>
|
||||
|
After Width: | Height: | Size: 232 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="10" width="11" height="8" transform="rotate(-30 6 18)"/><circle cx="6" cy="18" r="1.5"/><path d="M19 10.5A15 15 0 0 0 13.5 5"/><path d="M14.56 7.27 13.5 5l2.49-.22"/></svg>
|
||||
|
After Width: | Height: | Size: 371 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="13" width="7" height="7" stroke-dasharray="2 2"/><rect x="4" y="4" width="16" height="16"/><path d="M12 12l5-5M13.5 7H17v3.5"/></svg>
|
||||
|
After Width: | Height: | Size: 332 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 13 5 9.5 6 10 7.5 5 9 9l-.5.5 2 3-2.5-.5-1.5 1.5-1.5-1"/><path d="M15 10 21 20H9Z"/></svg>
|
||||
|
After Width: | Height: | Size: 288 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13.8 10.8a1.2 1.2 0 0 1 1.2 1.2a2.4 2.4 0 0 1-2.4 2.4a3.6 3.6 0 0 1-3.6-3.6a4.8 4.8 0 0 1 4.8-4.8a6 6 0 0 1 6 6a7.2 7.2 0 0 1-7.2 7.2a8.4 8.4 0 0 1-8.4-8.4V5.6"/><circle cx="4.2" cy="4.4" r="1.6" fill="currentColor"/></svg>
|
||||
|
After Width: | Height: | Size: 417 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 8l10 10 10-10"/><circle cx="12" cy="11.64" r="4.5"/></svg>
|
||||
|
After Width: | Height: | Size: 254 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 18h4c3 0 4-9 7-9s3 9 5.5 9h2.5"/><circle cx="13.5" cy="9.5" r="4"/></svg>
|
||||
|
After Width: | Height: | Size: 271 B |
@@ -27,12 +27,12 @@ use crate::{Tool, ToolInfo};
|
||||
pub const PATH_TOOLS: &[ToolInfo] = &[
|
||||
ToolInfo { id: anchor_eraser::ID, label: "Anchor Eraser Brush", shortcut: None, icon: "dc-remove-brush" },
|
||||
ToolInfo { id: extend_path::ID, label: "Extend Path Tool", shortcut: None, icon: "dc-arrow-extend" },
|
||||
ToolInfo { id: measure_inspect::ID, label: "Measure & Inspect Tool", shortcut: None, icon: "ruler" },
|
||||
ToolInfo { id: parametric_shape::ID, label: "Parametric Shape Tool", shortcut: None, icon: "hexagon" },
|
||||
ToolInfo { id: measure_inspect::ID, label: "Measure & Inspect Tool", shortcut: None, icon: "dc-measure-inspect" },
|
||||
ToolInfo { id: parametric_shape::ID, label: "Parametric Shape Tool", shortcut: None, icon: "dc-parametric-shape" },
|
||||
ToolInfo { id: corner_tool::ID, label: "Corner Tool", shortcut: None, icon: "dc-corner-tool" },
|
||||
ToolInfo { id: slide_anchor::ID, label: "Slide Anchor Along Path", shortcut: None, icon: "dc-slide-anchor" },
|
||||
ToolInfo { id: shared_edge::ID, label: "Shared Edge Merge Tool", shortcut: None, icon: "dc-shared-edge" },
|
||||
ToolInfo { id: tangent_circle::ID, label: "Tangent Circle Tool", shortcut: None, icon: "circle" },
|
||||
ToolInfo { id: tangent_circle::ID, label: "Tangent Circle Tool", shortcut: None, icon: "dc-tangent-circle" },
|
||||
];
|
||||
|
||||
/// Smart Pen's tool, a flyout group of its own.
|
||||
|
||||
@@ -77,7 +77,7 @@ pub(super) fn plain_selected(app: &VectorcraftApp) -> bool {
|
||||
|
||||
pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
if app.session.active().is_none() {
|
||||
empty_state(ui, "hexagon", tl!("No document"), tl!("Open a document to draw parametric shapes."));
|
||||
empty_state(ui, "dc-parametric-shape", tl!("No document"), tl!("Open a document to draw parametric shapes."));
|
||||
return;
|
||||
}
|
||||
let (id, s) = target(app);
|
||||
|
||||
@@ -50,15 +50,10 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) -> bool {
|
||||
|
||||
divider(ui);
|
||||
if tool == "box3d" {
|
||||
const SHAPES: [Choice; 6] = [
|
||||
("box3d", "3D Box", "web_colors"),
|
||||
("rectangle", "Rectangle", "square"),
|
||||
("ellipse", "Ellipse", "dc-ellipse"),
|
||||
("polygon", "Polygon", "dc-polygon"),
|
||||
("star", "Star", "star"),
|
||||
("spiral", "Spiral", "tornado"),
|
||||
];
|
||||
if let Some(shape) = choice(ui, "Shape", &active_shape, &SHAPES) {
|
||||
let shapes: [Choice; 6] =
|
||||
[("box3d", "3D Box"), ("rectangle", "Rectangle"), ("ellipse", "Ellipse"), ("polygon", "Polygon"), ("star", "Star"), ("spiral", "Spiral")]
|
||||
.map(|(id, label)| (id, label, shape_icon(id)));
|
||||
if let Some(shape) = choice(ui, "Shape", &active_shape, &shapes) {
|
||||
app.run("tool.setOption", json!({ "key": "shape", "value": shape })).ok();
|
||||
}
|
||||
divider(ui);
|
||||
@@ -314,8 +309,8 @@ fn draw_polygon_controls(app: &mut VectorcraftApp, ui: &mut Ui, opts: &Value, ac
|
||||
end_deg = a1;
|
||||
mode = mode_str(arc_mode);
|
||||
}
|
||||
const KINDS: [Choice; 2] = [("polygon", "Polygon", "dc-polygon"), ("star", "Star", "star")];
|
||||
match choice(ui, "Shape", if is_star { "star" } else { "polygon" }, &KINDS) {
|
||||
let kinds: [Choice; 2] = [("polygon", "Polygon", shape_icon("polygon")), ("star", "Star", shape_icon("star"))];
|
||||
match choice(ui, "Shape", if is_star { "star" } else { "polygon" }, &kinds) {
|
||||
Some("star") => apply_shape(app, &[("polyIsStar", json!(true))], json!({ "isStar": true, "spokeRatio": spoke })),
|
||||
Some(_) => apply_shape(app, &[("polyIsStar", json!(false))], json!({ "isStar": false })),
|
||||
None => {}
|
||||
@@ -414,6 +409,11 @@ fn draw_box3d_controls(app: &mut VectorcraftApp, ui: &mut Ui, opts: &Value, sele
|
||||
}
|
||||
}
|
||||
|
||||
/// The toolbar icon of the shape tool `id`, so the Control bar's shape buttons show the same icon.
|
||||
fn shape_icon(id: &str) -> &'static str {
|
||||
vectorcraft_tools::tool_info(id).map_or("square-dashed", |t| crate::icons::tool_icon(t.icon))
|
||||
}
|
||||
|
||||
fn mode_str(m: EllipseMode) -> &'static str {
|
||||
match m {
|
||||
EllipseMode::Slice => "pie",
|
||||
@@ -422,3 +422,24 @@ fn mode_str(m: EllipseMode) -> &'static str {
|
||||
EllipseMode::Whole => "whole",
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use craft::behavior::IconId;
|
||||
use craft::ui::primitives::{has_icon, register_app_icons};
|
||||
|
||||
use super::shape_icon;
|
||||
|
||||
/// The Control bar's shape buttons look their icons up by tool id; an id that names no tool
|
||||
/// would show the placeholder instead of the toolbar's icon.
|
||||
#[test]
|
||||
fn every_shape_button_shows_its_tools_icon() {
|
||||
register_app_icons(&crate::icons::APP_ICONS);
|
||||
for id in ["box3d", "rectangle", "ellipse", "polygon", "star", "spiral"] {
|
||||
let tool = vectorcraft_tools::tool_info(id).unwrap_or_else(|| panic!("{id} is a tool"));
|
||||
assert_eq!(shape_icon(id), crate::icons::tool_icon(tool.icon), "{id}");
|
||||
assert!(has_icon(&IconId::new(shape_icon(id))), "{id}'s icon {} isn't an icon", shape_icon(id));
|
||||
}
|
||||
assert_eq!(shape_icon("no-such-tool"), "square-dashed");
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-arrow-extend", include_bytes!("../../../assets/icons/dc-arrow-extend.svg")),
|
||||
("dc-arrow-tip", include_bytes!("../../../assets/icons/dc-arrow-tip.svg")),
|
||||
("dc-arrow-up", include_bytes!("../../../assets/icons/dc-arrow-up.svg")),
|
||||
("dc-artboard", include_bytes!("../../../assets/icons/dc-artboard.svg")),
|
||||
("dc-artboard-options", include_bytes!("../../../assets/icons/dc-artboard-options.svg")),
|
||||
("dc-artboards", include_bytes!("../../../assets/icons/dc-artboards.svg")),
|
||||
("dc-blend", include_bytes!("../../../assets/icons/dc-blend.svg")),
|
||||
@@ -57,6 +58,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-blend-align-page", include_bytes!("../../../assets/icons/dc-blend-align-page.svg")),
|
||||
("dc-blend-align-path", include_bytes!("../../../assets/icons/dc-blend-align-path.svg")),
|
||||
("dc-bloat", include_bytes!("../../../assets/icons/dc-bloat.svg")),
|
||||
("dc-blob-brush", include_bytes!("../../../assets/icons/dc-blob-brush.svg")),
|
||||
("dc-cap-butt", include_bytes!("../../../assets/icons/dc-cap-butt.svg")),
|
||||
("dc-cap-round", include_bytes!("../../../assets/icons/dc-cap-round.svg")),
|
||||
("dc-cap-square", include_bytes!("../../../assets/icons/dc-cap-square.svg")),
|
||||
@@ -135,6 +137,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-live-select", include_bytes!("../../../assets/icons/dc-live-select.svg")),
|
||||
("dc-mask-none", include_bytes!("../../../assets/icons/dc-mask-none.svg")),
|
||||
("dc-measure", include_bytes!("../../../assets/icons/dc-measure.svg")),
|
||||
("dc-measure-inspect", include_bytes!("../../../assets/icons/dc-measure-inspect.svg")),
|
||||
("dc-mesh", include_bytes!("../../../assets/icons/dc-mesh.svg")),
|
||||
("dc-mirror-cut", include_bytes!("../../../assets/icons/dc-mirror-cut.svg")),
|
||||
("dc-new-fill", include_bytes!("../../../assets/icons/dc-new-fill.svg")),
|
||||
@@ -153,6 +156,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-para-numbers", include_bytes!("../../../assets/icons/dc-para-numbers.svg")),
|
||||
("dc-para-right", include_bytes!("../../../assets/icons/dc-para-right.svg")),
|
||||
("dc-para-rtl", include_bytes!("../../../assets/icons/dc-para-rtl.svg")),
|
||||
("dc-parametric-shape", include_bytes!("../../../assets/icons/dc-parametric-shape.svg")),
|
||||
("dc-path-eraser", include_bytes!("../../../assets/icons/dc-path-eraser.svg")),
|
||||
("dc-pathfinder", include_bytes!("../../../assets/icons/dc-pathfinder.svg")),
|
||||
("dc-perspective", include_bytes!("../../../assets/icons/dc-perspective.svg")),
|
||||
@@ -170,32 +174,38 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-place-symbol", include_bytes!("../../../assets/icons/dc-place-symbol.svg")),
|
||||
("dc-polar-grid", include_bytes!("../../../assets/icons/dc-polar-grid.svg")),
|
||||
("dc-polygon", include_bytes!("../../../assets/icons/dc-polygon.svg")),
|
||||
("dc-print-tiling", include_bytes!("../../../assets/icons/dc-print-tiling.svg")),
|
||||
("dc-pucker", include_bytes!("../../../assets/icons/dc-pucker.svg")),
|
||||
("dc-puppet", include_bytes!("../../../assets/icons/dc-puppet.svg")),
|
||||
("dc-quick-pen", include_bytes!("../../../assets/icons/dc-quick-pen.svg")),
|
||||
("dc-rearrange", include_bytes!("../../../assets/icons/dc-rearrange.svg")),
|
||||
("dc-recolor-arrow", include_bytes!("../../../assets/icons/dc-recolor-arrow.svg")),
|
||||
("dc-recolor-arrow-off", include_bytes!("../../../assets/icons/dc-recolor-arrow-off.svg")),
|
||||
("dc-rect", include_bytes!("../../../assets/icons/dc-rect.svg")),
|
||||
("dc-rect-cut", include_bytes!("../../../assets/icons/dc-rect-cut.svg")),
|
||||
("dc-rect-grid", include_bytes!("../../../assets/icons/dc-rect-grid.svg")),
|
||||
("dc-reference-point", include_bytes!("../../../assets/icons/dc-reference-point.svg")),
|
||||
("dc-remove-brush", include_bytes!("../../../assets/icons/dc-remove-brush.svg")),
|
||||
("dc-reshape", include_bytes!("../../../assets/icons/dc-reshape.svg")),
|
||||
("dc-reverse", include_bytes!("../../../assets/icons/dc-reverse.svg")),
|
||||
("dc-rotate", include_bytes!("../../../assets/icons/dc-rotate.svg")),
|
||||
("dc-rotate-view", include_bytes!("../../../assets/icons/dc-rotate-view.svg")),
|
||||
("dc-rounded-rect", include_bytes!("../../../assets/icons/dc-rounded-rect.svg")),
|
||||
("dc-rule-evenodd", include_bytes!("../../../assets/icons/dc-rule-evenodd.svg")),
|
||||
("dc-rule-nonzero", include_bytes!("../../../assets/icons/dc-rule-nonzero.svg")),
|
||||
("dc-scale", include_bytes!("../../../assets/icons/dc-scale.svg")),
|
||||
("dc-scallop", include_bytes!("../../../assets/icons/dc-scallop.svg")),
|
||||
("dc-screen-mode", include_bytes!("../../../assets/icons/dc-screen-mode.svg")),
|
||||
("dc-selection", include_bytes!("../../../assets/icons/dc-selection.svg")),
|
||||
("dc-shape-builder", include_bytes!("../../../assets/icons/dc-shape-builder.svg")),
|
||||
("dc-shaper", include_bytes!("../../../assets/icons/dc-shaper.svg")),
|
||||
("dc-shared-edge", include_bytes!("../../../assets/icons/dc-shared-edge.svg")),
|
||||
("dc-shear", include_bytes!("../../../assets/icons/dc-shear.svg")),
|
||||
("dc-slice", include_bytes!("../../../assets/icons/dc-slice.svg")),
|
||||
("dc-slice-select", include_bytes!("../../../assets/icons/dc-slice-select.svg")),
|
||||
("dc-slide-anchor", include_bytes!("../../../assets/icons/dc-slide-anchor.svg")),
|
||||
("dc-smooth", include_bytes!("../../../assets/icons/dc-smooth.svg")),
|
||||
("dc-spiral", include_bytes!("../../../assets/icons/dc-spiral.svg")),
|
||||
("dc-stroke", include_bytes!("../../../assets/icons/dc-stroke.svg")),
|
||||
("dc-stroke-center", include_bytes!("../../../assets/icons/dc-stroke-center.svg")),
|
||||
("dc-stroke-inside", include_bytes!("../../../assets/icons/dc-stroke-inside.svg")),
|
||||
@@ -213,6 +223,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-symbol-sprayer", include_bytes!("../../../assets/icons/dc-symbol-sprayer.svg")),
|
||||
("dc-symbol-stainer", include_bytes!("../../../assets/icons/dc-symbol-stainer.svg")),
|
||||
("dc-symbol-styler", include_bytes!("../../../assets/icons/dc-symbol-styler.svg")),
|
||||
("dc-tangent-circle", include_bytes!("../../../assets/icons/dc-tangent-circle.svg")),
|
||||
("dc-touch-type", include_bytes!("../../../assets/icons/dc-touch-type.svg")),
|
||||
("dc-transform-panel", include_bytes!("../../../assets/icons/dc-transform-panel.svg")),
|
||||
("dc-transparency", include_bytes!("../../../assets/icons/dc-transparency.svg")),
|
||||
@@ -223,6 +234,7 @@ pub static ICONS: &[(&str, &[u8])] = &[
|
||||
("dc-type-vertical", include_bytes!("../../../assets/icons/dc-type-vertical.svg")),
|
||||
("dc-type-vertical-area", include_bytes!("../../../assets/icons/dc-type-vertical-area.svg")),
|
||||
("dc-type-vertical-path", include_bytes!("../../../assets/icons/dc-type-vertical-path.svg")),
|
||||
("dc-warp", include_bytes!("../../../assets/icons/dc-warp.svg")),
|
||||
("dc-width", include_bytes!("../../../assets/icons/dc-width.svg")),
|
||||
("dc-width-profile", include_bytes!("../../../assets/icons/dc-width-profile.svg")),
|
||||
("dc-wrinkle", include_bytes!("../../../assets/icons/dc-wrinkle.svg")),
|
||||
|
||||
@@ -36,10 +36,10 @@ pub fn tool_icon(name: &str) -> &'static str {
|
||||
"tool-line" => "dc-line",
|
||||
"tool-arc" => "dc-arc",
|
||||
"tool-three-point-arc" => "dc-arc-three-point",
|
||||
"tool-spiral" => "tornado",
|
||||
"tool-spiral" => "dc-spiral",
|
||||
"tool-rect-grid" => "dc-rect-grid",
|
||||
"tool-polar-grid" => "dc-polar-grid",
|
||||
"tool-rect" => "square",
|
||||
"tool-rect" => "dc-rect",
|
||||
"tool-rounded-rect" => "dc-rounded-rect",
|
||||
"tool-ellipse" => "dc-ellipse",
|
||||
"tool-circle" => "dc-circle-points",
|
||||
@@ -48,8 +48,8 @@ pub fn tool_icon(name: &str) -> &'static str {
|
||||
"tool-star" => "star",
|
||||
"tool-flare" => "dc-flare",
|
||||
"tool-brush" => "paintbrush",
|
||||
"tool-blob-brush" => "brush",
|
||||
"tool-shaper" => "shapes",
|
||||
"tool-blob-brush" => "dc-blob-brush",
|
||||
"tool-shaper" => "dc-shaper",
|
||||
"tool-pencil" => "pencil",
|
||||
"tool-smooth" => "dc-smooth",
|
||||
"tool-path-eraser" => "dc-path-eraser",
|
||||
@@ -60,13 +60,13 @@ pub fn tool_icon(name: &str) -> &'static str {
|
||||
"tool-mirror-cut" => "dc-mirror-cut",
|
||||
"tool-line-cut" => "dc-line-cut",
|
||||
"tool-rect-cut" => "dc-rect-cut",
|
||||
"tool-rotate" => "rotate_ccw",
|
||||
"tool-rotate" => "dc-rotate",
|
||||
"tool-reflect" => "flip-horizontal-2",
|
||||
"tool-scale" => "scaling",
|
||||
"tool-scale" => "dc-scale",
|
||||
"tool-shear" => "dc-shear",
|
||||
"tool-reshape" => "dc-reshape",
|
||||
"tool-width" => "dc-width",
|
||||
"tool-warp" => "waves",
|
||||
"tool-warp" => "dc-warp",
|
||||
"tool-twirl" => "dc-twirl",
|
||||
"tool-pucker" => "dc-pucker",
|
||||
"tool-bloat" => "dc-bloat",
|
||||
@@ -106,12 +106,12 @@ pub fn tool_icon(name: &str) -> &'static str {
|
||||
"tool-graph-scatter" => "dc-graph-scatter",
|
||||
"tool-graph-pie" => "dc-graph-pie",
|
||||
"tool-graph-radar" => "dc-graph-radar",
|
||||
"tool-artboard" => "artboard",
|
||||
"tool-artboard" => "dc-artboard",
|
||||
"tool-slice" => "dc-slice",
|
||||
"tool-slice-select" => "dc-slice-select",
|
||||
"tool-hand" => "hand",
|
||||
"tool-rotate-view" => "dc-rotate-view",
|
||||
"tool-print-tiling" => "printer",
|
||||
"tool-print-tiling" => "dc-print-tiling",
|
||||
"tool-zoom" => "zoom_in",
|
||||
// A name that is already an icon maps to itself, as the `'static` name of the set that has it.
|
||||
other => icon_names().iter().copied().chain(APP_ICONS.icons.iter().map(|(n, _)| *n)).find(|n| *n == other).unwrap_or("rect_dashed"),
|
||||
@@ -207,6 +207,35 @@ mod tests {
|
||||
assert!(appearance.contains("<circle") && !pathfinder.contains("<circle"), "appearance should read as a list, not overlapping squares");
|
||||
}
|
||||
|
||||
/// These tools used general-purpose library icons whose picture did not show the tool (a tornado
|
||||
/// for Spiral, waves for Warp, a printer for Print Tiling). Each has an icon drawn for
|
||||
/// VectorCraft that no other tool uses.
|
||||
#[test]
|
||||
fn tools_with_drawn_icons_do_not_fall_back_to_library_icons() {
|
||||
let tools = [
|
||||
"spiral",
|
||||
"rectangle",
|
||||
"blobBrush",
|
||||
"shaper",
|
||||
"rotate",
|
||||
"scale",
|
||||
"warp",
|
||||
"artboard",
|
||||
"printTiling",
|
||||
"measureInspect",
|
||||
"parametricShape",
|
||||
"tangentCircle",
|
||||
];
|
||||
for id in tools {
|
||||
let name = tool_icon(vectorcraft_tools::tool_info(id).unwrap_or_else(|| panic!("{id} is a tool")).icon);
|
||||
assert!(name.starts_with("dc-"), "{id} maps to {name}, a library icon");
|
||||
assert!(resolves(name), "{id} maps to {name}, which isn't an icon");
|
||||
let shared: Vec<&str> =
|
||||
vectorcraft_tools::catalog::all_tools().filter(|t| t.id != id && tool_icon(t.icon) == name).map(|t| t.id).collect();
|
||||
assert!(shared.is_empty(), "{id} shares {name} with {shared:?}");
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for #479: the Add and Delete Anchor Point tools' icons were drawn apart from
|
||||
// the Pen tool's, so the three tools didn't read as one family. They are the Pen's pen with a
|
||||
// plus or a minus beside it.
|
||||
|
||||
@@ -285,7 +285,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[
|
||||
(crate::addons::packaging::ID, "Fold Lines", "scissors"),
|
||||
(crate::addons::packaging::preview::ID, "Fold Preview", "dc-cube"),
|
||||
(crate::addons::pathtools::ID, "Anchor Inspector", "dc-anchor-smooth"),
|
||||
(crate::addons::pathtools::shape::ID, "Parametric Shape", "hexagon"),
|
||||
(crate::addons::pathtools::shape::ID, "Parametric Shape", "dc-parametric-shape"),
|
||||
(crate::addons::pen::ID, "Smart Pen", "spline-pointer"),
|
||||
(crate::addons::units::ID, "Unit Converter", "ruler"),
|
||||
];
|
||||
|
||||