diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 97759ba03a..865adcc282 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -1555,6 +1555,20 @@ fn headless_backend_methods() { let selected = h.call("ui.tool.select", json!({"tool": tool.id})).unwrap(); assert_eq!(selected["tool"], tool.id); } + // The Trim at Crossings Tool is listed once, in the Scissors tool's group after the Knife. + let trim = vectorcraft_tools::addons::trim::ID; + let with_trim: Vec<_> = + groups.iter().map(|group| group.as_array().unwrap()).filter(|group| group.iter().any(|entry| entry["id"] == trim)).collect(); + assert_eq!(with_trim.len(), 1, "{trim} is in one group"); + let ids: Vec<_> = with_trim[0].iter().map(|entry| entry["id"].clone()).collect(); + let knife = ids.iter().position(|id| *id == "knife").expect("the Knife in the same group"); + assert!(ids.contains(&json!("scissors")), "the Scissors tool's group: {ids:?}"); + assert_eq!(ids.get(knife + 1), Some(&json!(trim))); + assert_eq!(ids.iter().filter(|id| **id == trim).count(), 1); + let entry = with_trim[0].iter().find(|entry| entry["id"] == trim).unwrap(); + assert_eq!(entry["label"], "Trim at Crossings Tool"); + assert!(entry["shortcut"].is_null()); + assert_eq!(h.call("ui.tool.select", json!({"tool": trim})).unwrap()["tool"], trim); let polygonal = groups.iter().flat_map(|group| group.as_array().unwrap()).find(|entry| entry["id"] == "polygonalLasso"); assert_eq!(polygonal.map(|entry| entry["label"].clone()), Some(json!("Polygonal Lasso Tool"))); assert!(h.call("ui.resize", json!({})).is_err()); diff --git a/crates/tools/src/addons.rs b/crates/tools/src/addons.rs index 707b058023..c75a73882a 100644 --- a/crates/tools/src/addons.rs +++ b/crates/tools/src/addons.rs @@ -1,6 +1,8 @@ //! The tools of VectorCraft's built-in add-ons. They aren't in the toolbars as they ship: the All //! Tools drawer lists them (under their add-on's heading) so they can be added, and each add-on's -//! submenu selects them. Tool gestures emit engine commands. +//! submenu selects them. Tool gestures emit engine commands. The Trim at Crossings Tool is the +//! exception: it is in the Scissors tool's group ([`crate::TOOL_GROUPS`]), where the toolbars and +//! the All Tools drawer show it, as well as in Path Precision Tools' submenu. pub mod anchor_eraser; pub mod box3d; @@ -18,7 +20,8 @@ pub mod trim; use crate::{Tool, ToolInfo}; -/// Path Precision Tools' tools, one flyout group. +/// Path Precision Tools' tools, one flyout group. Its Trim at Crossings Tool ([`trim::ID`]) is in +/// the Scissors tool's group instead. 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" }, @@ -27,7 +30,6 @@ pub const PATH_TOOLS: &[ToolInfo] = &[ ToolInfo { id: corner_tool::ID, label: "Corner Tool", shortcut: None, icon: "dc-rounded-rect" }, ToolInfo { id: slide_anchor::ID, label: "Slide Anchor Along Path", shortcut: None, icon: "dc-anchor" }, ToolInfo { id: shared_edge::ID, label: "Shared Edge Merge Tool", shortcut: None, icon: "dc-join" }, - ToolInfo { id: trim::ID, label: "Trim at Crossings Tool", shortcut: None, icon: "dc-pf-trim" }, ]; /// Smart Pen's tool, a flyout group of its own. @@ -103,4 +105,21 @@ mod tests { assert!(crate::catalog::all_tools().any(|t| t.id == extend_path::ID)); assert!(create("pen").is_none() && heading("pen").is_none()); } + + /// The Trim at Crossings Tool is the add-on tool in a built-in group: the Scissors tool's, + /// after the Knife, with no default shortcut, listed once, and still made by its add-on. + #[test] + fn trim_at_crossings_is_in_the_scissors_group_once() { + let groups: Vec<_> = crate::TOOL_GROUPS.iter().filter(|g| g.iter().any(|t| t.id == trim::ID)).collect(); + assert_eq!(groups.len(), 1); + let ids: Vec<_> = groups[0].iter().map(|t| t.id).collect(); + let knife = ids.iter().position(|id| *id == "knife").expect("the Knife's group"); + assert!(ids.contains(&"scissors")); + assert_eq!(ids.get(knife + 1), Some(&trim::ID)); + let info = crate::tool_info(trim::ID).expect("catalogued"); + assert_eq!((info.label, info.shortcut, info.icon), ("Trim at Crossings Tool", None, "dc-pf-trim")); + assert_eq!(create(trim::ID).map(|tool| tool.id()), Some(trim::ID)); + assert!(!GROUPS.iter().any(|g| g.iter().any(|t| t.id == trim::ID)), "not listed again under the add-on"); + assert_eq!(crate::catalog::all_tools().filter(|t| t.id == trim::ID).count(), 1); + } } diff --git a/crates/tools/src/addons/trim.rs b/crates/tools/src/addons/trim.rs index 9c0681f4b4..772148ea88 100644 --- a/crates/tools/src/addons/trim.rs +++ b/crates/tools/src/addons/trim.rs @@ -258,7 +258,7 @@ impl Tool for TrimTool { } fn cursor(&self, _cx: &ToolContext, _p: Point, _mods: Mods) -> Cursor { - Cursor::Crosshair + Cursor::Knife } } @@ -287,7 +287,8 @@ mod tests { let up = t.pointer(&cx, &ev(PointerKind::Up, 100.5, 100.0)); assert_eq!(up, vec![Action::Exec(COMMAND.into(), json!({"at": [100.0, 100.0], "tolerance": 2.0}))], "4 px at 200%"); assert!(!t.busy()); - assert_eq!(t.cursor(&cx, Point::ZERO, Mods::default()), Cursor::Crosshair); + assert_eq!(t.cursor(&cx, Point::ZERO, Mods::default()), Cursor::Knife, "the Knife's cursor, the blade's point on the pointer"); + assert_eq!(Cursor::Knife.precise(), Cursor::Crosshair, "Use Precise Cursors shows the crosshair"); } #[test] diff --git a/crates/tools/src/catalog.rs b/crates/tools/src/catalog.rs index 9bbd7cbdfb..386dfeb4a5 100644 --- a/crates/tools/src/catalog.rs +++ b/crates/tools/src/catalog.rs @@ -68,6 +68,9 @@ pub const TOOL_GROUPS: &[&[ToolInfo]] = &[ t("eraser", "Eraser Tool", Some("Shift+E"), "tool-eraser"), t("scissors", "Scissors Tool", Some("C"), "tool-scissors"), t("knife", "Knife", None, "tool-knife"), + // Path Precision Tools' Trim at Crossings Tool, kept out of `addons::PATH_TOOLS` so that + // `all_tools` lists it once. + t(crate::addons::trim::ID, "Trim at Crossings Tool", None, "dc-pf-trim"), t("mirrorCut", "Mirror & Cut Tool", None, "tool-mirror-cut"), t("lineCut", "Line Cut Tool", None, "tool-line-cut"), t("rectCut", "Rectangle Cut Tool", None, "tool-rect-cut"), diff --git a/crates/tools/src/cursor.rs b/crates/tools/src/cursor.rs index 85b9cf258e..6c883a97e8 100644 --- a/crates/tools/src/cursor.rs +++ b/crates/tools/src/cursor.rs @@ -139,7 +139,7 @@ pub enum Cursor { PathEraser, /// The Join tool. Join, - /// The Knife tool. + /// The Knife tool and the Trim at Crossings Tool. Knife, /// The Shaper tool. Shaper, @@ -339,7 +339,6 @@ impl Cursor { | Cursor::Smooth | Cursor::PathEraser | Cursor::Join - | Cursor::Knife | Cursor::Shaper | Cursor::Measure | Cursor::ObjectsOnPath diff --git a/crates/tools/src/cursors.toml b/crates/tools/src/cursors.toml index 34bea168ea..07023d390d 100644 --- a/crates/tools/src/cursors.toml +++ b/crates/tools/src/cursors.toml @@ -721,8 +721,12 @@ hotspot = "The tip." [[cursor]] id = "Knife" group = "Drawing and editing tools" -shown_when = ["The Knife tool: a freehand drag cuts objects along the line."] +shown_when = [ + "The Knife tool: a freehand drag cuts objects along the line.", + "The Trim at Crossings Tool: a click removes the stretch of path under the pointer between its crossings, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses.", +] hotspot = "The blade's point." +look = "A knife pointing down-left: a white blade with a straight back and a curved edge, and a black handle." [[cursor]] id = "Scissors" diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 07579cd456..7526717665 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -696,6 +696,7 @@ mod cursor_tests { ("pathEraser", Cursor::PathEraser), ("join", Cursor::Join), ("knife", Cursor::Knife), + (addons::trim::ID, Cursor::Knife), ("shaper", Cursor::Shaper), ("livePaintBucket", Cursor::LivePaintBucket), ("measure", Cursor::Measure), @@ -713,10 +714,10 @@ mod cursor_tests { assert_eq!(cursor_of(id), c, "{id}"); assert_eq!(c.precise(), Cursor::Crosshair, "{id}"); // The Blob Brush's and the Eraser's dot is drawn: their tip outline goes round it. The - // Live Paint Bucket's bucket is drawn. + // Live Paint Bucket's bucket and the Knife's knife are drawn. let stand_in = match id { "mesh" => Some(Cursor::PenAdd), - "blobBrush" | "eraser" | "livePaintBucket" => None, + "blobBrush" | "eraser" | "livePaintBucket" | "knife" | addons::trim::ID => None, _ => Some(Cursor::Crosshair), }; assert_eq!(c.stand_in(), stand_in, "{id}"); diff --git a/crates/ui-egui/src/addons/pathtools/tests.rs b/crates/ui-egui/src/addons/pathtools/tests.rs index de01be5b7d..3f7006e536 100644 --- a/crates/ui-egui/src/addons/pathtools/tests.rs +++ b/crates/ui-egui/src/addons/pathtools/tests.rs @@ -25,6 +25,7 @@ fn the_plugins_submenu_selects_the_tools_and_opens_the_anchor_inspector() { ("Trim at Crossings Tool", "trimAtCrossings"), ] { let e = under(label).expect(label); + assert_eq!(vectorcraft_tools::tool_info(tool).map(|t| t.label), Some(label), "the toolbar's label"); assert_eq!((e.command.as_deref(), &e.params), (Some("tool.select"), &json!({ "tool": tool }))); menus::invoke(&mut app, "tool.select", e.params.clone()); assert_eq!(app.session.tool_id(), tool); diff --git a/crates/ui-egui/src/canvas/cursor.rs b/crates/ui-egui/src/canvas/cursor.rs index ca017bef3e..631809ed8a 100644 --- a/crates/ui-egui/src/canvas/cursor.rs +++ b/crates/ui-egui/src/canvas/cursor.rs @@ -127,6 +127,8 @@ pub(super) fn cursor_icon(c: Cursor) -> egui::CursorIcon { // The system has no tip outline to go round: its crosshair aims as well. Cursor::BlobBrush | Cursor::Eraser => C::Crosshair, Cursor::LivePaintBucket | Cursor::LivePaintBucketFace | Cursor::LivePaintBucketEdge => C::Crosshair, + // The system has no knife: its crosshair aims at the blade's point. + Cursor::Knife => C::Crosshair, // Not drawn yet: the cursor each borrows. Cursor::Lasso | Cursor::MagicWand @@ -135,7 +137,6 @@ pub(super) fn cursor_icon(c: Cursor) -> egui::CursorIcon { | Cursor::Smooth | Cursor::PathEraser | Cursor::Join - | Cursor::Knife | Cursor::Shaper | Cursor::Measure | Cursor::PrintTiling diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs index 5495d3753c..bcb6744c12 100644 --- a/crates/ui-egui/src/cursors.rs +++ b/crates/ui-egui/src/cursors.rs @@ -468,6 +468,23 @@ fn paint_brush(p: &mut Ink, o: Pos2) { } } +/// The Knife and the Trim at Crossings Tool: a knife, the blade's point on the hotspot, the white +/// blade with its straight back and curved edge, then the black handle running up-right. +fn knife(p: &mut Ink, o: Pos2) { + let (d, n) = (vec2(1.0, -1.0).normalized(), vec2(1.0, 1.0).normalized()); + let at = |u: f32, v: f32| o + u * d + v * n; + let blade = vec![at(0.0, 0.0), at(11.0, -2.5), at(11.0, 3.0), at(6.0, 2.8), at(2.5, 1.6)]; + let handle = vec![at(11.0, -2.0), at(20.0, -1.8), at(21.0, 0.2), at(20.0, 2.2), at(11.0, 2.5)]; + // Both halos first, so neither covers the other's outline. + for part in [&blade, &handle] { + p.add(Shape::closed_line(part.clone(), Stroke::new(3.0, HALO))); + } + for (part, fill) in [(blade, HALO), (handle, INK)] { + p.add(Shape::convex_polygon(part.clone(), fill, Stroke::NONE)); + p.add(Shape::closed_line(part, Stroke::new(1.0, INK))); + } +} + /// Live Paint Selection: the solid arrow with a badge at its lower right saying what a click /// selects: a filled square over a face ([`Cursor::LivePaintSelectFace`]), a short line between two /// anchor marks over an edge ([`Cursor::LivePaintSelectEdge`]), an x where it selects nothing. @@ -732,6 +749,7 @@ fn glyph(c: Cursor, p: Pos2) -> Option> { Cursor::LivePaintBucket => paint_bucket(ink, p, false), Cursor::LivePaintBucketFace => paint_bucket(ink, p, true), Cursor::LivePaintBucketEdge => paint_brush(ink, p), + Cursor::Knife => knife(ink, p), Cursor::LivePaintSelectFace | Cursor::LivePaintSelectEdge | Cursor::LivePaintSelectOutside => live_paint_select(ink, p, c), Cursor::Hand => hand(ink, p, false), Cursor::HandGrab => hand(ink, p, true), diff --git a/crates/ui-egui/src/cursors/tests.rs b/crates/ui-egui/src/cursors/tests.rs index 49c932175d..8ac9a3ab2f 100644 --- a/crates/ui-egui/src/cursors/tests.rs +++ b/crates/ui-egui/src/cursors/tests.rs @@ -336,6 +336,34 @@ fn the_live_paint_bucket_shows_a_bucket_or_a_brush() { } } +/// The Knife's cursor, which the Trim at Crossings Tool shows too, is drawn, not the crosshair: a +/// knife with the blade's point on the hotspot, the white blade, then the black handle up-right. +#[test] +fn the_knife_shows_a_knife_with_its_point_on_the_hotspot() { + for ppp in [1.0f32, 2.0] { + let img = |c| rasterize(c, ppp).unwrap_or_else(|| panic!("{c:?} at {ppp}")); + let (cross, knife, brush) = (img(Cursor::Crosshair), img(Cursor::Knife), img(Cursor::LivePaintBucketEdge)); + // The pixel nearest the point `u` points up-right of the hotspot and `v` down-right across. + let at = |img: &CustomCursorImage, u: f32, v: f32| { + let s = std::f32::consts::FRAC_1_SQRT_2; + let [hx, hy] = img.hotspot.map(f32::from); + let (x, y) = ((hx + (u + v) * s * ppp - 0.5).round(), (hy + (v - u) * s * ppp - 0.5).round()); + let inside = x >= 0.0 && y >= 0.0 && x < f32::from(img.size[0]) && y < f32::from(img.size[1]); + if inside { pixel(img, x as usize, y as usize) } else { [0; 4] } + }; + let inked = |p: [u8; 4]| p[3] > 200 && p[0] < 64; + let white = |p: [u8; 4]| p[3] > 200 && p[0] > 192; + assert!(at(&knife, 0.0, 0.0)[3] > 0, "the point covers the hotspot at {ppp}"); + assert!(white(at(&knife, 8.0, 0.5)), "the white blade at {ppp}"); + assert!(inked(at(&knife, 16.0, 0.2)), "the black handle at {ppp}"); + assert!(!inked(at(&knife, -4.0, 0.0)), "nothing beyond the point at {ppp}"); + assert!(Cursor::Knife.stand_in().is_none(), "the Knife is drawn"); + assert_ne!(knife, cross, "the Knife is not the crosshair at {ppp}"); + assert_ne!(knife, brush, "the Knife is not the Live Paint brush at {ppp}"); + assert_eq!(rasterize(Cursor::Knife.precise(), ppp).as_ref(), Some(&cross), "with Use Precise Cursors at {ppp}"); + } +} + /// Live Paint Selection's cursors are the solid arrow, its tip on the hotspot, with a badge at its /// lower right: a filled square over a face, a line between two anchor marks over an edge, and an x /// where a click selects nothing. diff --git a/crates/ui-egui/src/edit_toolbar/tests.rs b/crates/ui-egui/src/edit_toolbar/tests.rs index fedfe9dcfd..ecb6f15ea9 100644 --- a/crates/ui-egui/src/edit_toolbar/tests.rs +++ b/crates/ui-egui/src/edit_toolbar/tests.rs @@ -629,8 +629,56 @@ fn drop_targets_follow_the_buttons_edges() { assert_eq!(drop_target(&[], pos2(0.0, 0.0), 1), (None, Place::Before)); } -/// The add-ons' tools are in neither toolbar as they ship: the drawer lists them under their -/// add-on's heading, and they can be added from there. +/// The Trim at Crossings Tool is in the Scissors tool's flyout in both toolbars, after the Knife, +/// once in the All Tools drawer and in Keyboard Shortcuts' list, with no shortcut; Reset Toolbar +/// keeps it there. +#[test] +fn trim_at_crossings_is_in_the_scissors_flyout() { + let mut app = app(); + let trim = vectorcraft_tools::addons::trim::ID; + for advanced in [false, true] { + if advanced { + app.run("window.toolbarAdvanced", json!({})).unwrap(); + } + let s = slots(&app); + let slot = slot_of(&app, "scissors").map(|i| s[i].clone()).expect("a Scissors slot"); + let knife = slot.iter().position(|id| *id == "knife").expect("the Knife beside the Scissors"); + assert_eq!(slot.get(knife + 1), Some(&trim), "advanced: {advanced}"); + assert_eq!(s.iter().filter(|ids| ids.contains(&trim)).count(), 1, "advanced: {advanced}"); + } + assert_eq!(sections().iter().flat_map(|(_, tools)| tools.iter()).filter(|t| t.id == trim).count(), 1, "listed once in the drawer"); + assert_eq!(vectorcraft_tools::catalog::all_tools().filter(|t| t.id == trim).count(), 1, "listed once for Keyboard Shortcuts"); + assert_eq!(vectorcraft_tools::tool_info(trim).map(|t| (t.label, t.shortcut)), Some(("Trim at Crossings Tool", None))); + app.run("tool.select", json!({"tool": trim})).unwrap(); + assert_eq!(app.session.tool_id(), trim); + let shown = slot_of(&app, trim).map(|i| crate::toolbar::shown_tool(&app, &slots(&app)[i])); + assert_eq!(shown, Some(trim), "the slot's button shows the tool once chosen"); + app.run("toolbar.removeTool", json!({"tool": trim})).unwrap(); + assert!(slot_of(&app, trim).is_none(), "it can be taken out"); + app.run("toolbar.reset", json!({})).unwrap(); + let after_reset = slot_of(&app, "scissors").map(|i| slots(&app)[i].contains(&trim)); + assert_eq!(after_reset, Some(true), "Reset Toolbar puts it back"); +} + +/// A toolbar edited and saved before the Trim at Crossings Tool joined the Scissors group keeps +/// its saved layout: the tool stays in the drawer until Reset Toolbar or a drag adds it. +#[test] +fn a_saved_toolbar_without_trim_at_crossings_keeps_its_layout() { + let mut app = app(); + let trim = vectorcraft_tools::addons::trim::ID; + let saved = ToolbarCategory { name: Some("Draw".into()), slots: vec![["eraser", "scissors", "knife"].iter().map(|id| id.to_string()).collect()] }; + app.ui.toolbar_edits = ToolbarEdits { basic: Some(vec![saved]), advanced: None }; + app.ui = std::mem::take(&mut app.ui).sanitized(); + assert_eq!(slots(&app), [["eraser", "scissors", "knife"]]); + assert!(slot_of(&app, trim).is_none()); + app.run("toolbar.reset", json!({})).unwrap(); + let slot = slot_of(&app, "scissors").map(|i| slots(&app)[i].clone()); + assert!(slot.is_some_and(|s| s.contains(&trim)), "Reset Toolbar adds it"); +} + +/// The add-ons' tools are in neither toolbar as they ship (the Trim at Crossings Tool, in the +/// Scissors tool's group, aside): the drawer lists them under their add-on's heading, and they can +/// be added from there. #[test] fn addon_tools_are_in_the_drawer_not_the_toolbars() { let mut app = app(); @@ -649,7 +697,6 @@ fn addon_tools_are_in_the_drawer_not_the_toolbars() { "cornerTool", "slideAnchor", "sharedEdge", - "trimAtCrossings", "smartPen", enclosing, contour, @@ -666,7 +713,7 @@ fn addon_tools_are_in_the_drawer_not_the_toolbars() { let listed = |id: &str| { sections().iter().find(|(_, tools)| tools.iter().any(|t| t.id == id)).map(|(h, tools)| (*h, tools.iter().map(|t| t.id).collect::>())) }; - assert_eq!(listed("extendPath"), Some(("Path Precision Tools", addon[..8].to_vec()))); + assert_eq!(listed("extendPath"), Some(("Path Precision Tools", addon[..7].to_vec()))); assert_eq!(listed("smartPen"), Some(("Smart Pen", vec!["smartPen"]))); assert_eq!(listed(enclosing), Some(("Enclosing Lasso", vec![enclosing]))); assert_eq!(listed(contour), Some(("Contour", vec![contour]))); diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index c8cbd94cfd..8afa8f571a 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -47,7 +47,7 @@ pub const BASIC: &[(&str, &[&[&str]])] = &[ "Draw", &[ &["pencil", "smooth", "pathEraser", "join"], - &["eraser", "scissors", "knife", "mirrorCut", "lineCut", "rectCut"], + &["eraser", "scissors", "knife", "trimAtCrossings", "mirrorCut", "lineCut", "rectCut"], &["paintbrush", "blobBrush"], &["pen", "addAnchor", "deleteAnchor", "anchorPoint"], &["curvature"], diff --git a/docs/mcp.md b/docs/mcp.md index 105f6ef308..b6d3cb64ce 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -12285,10 +12285,12 @@ type and evening out horizontal scales are not there yet. Path Precision Tools is a built-in add-on for exact anchor and path work: its commands are `addon.pathtools.*`, and in the desktop app it lives in Object › Plug-ins › Path Precision Tools, in its Anchor Inspector panel (`window.panel {panel: "anchorInspector"}`), in its Parametric Shape panel (`window.panel {panel: "parametricShape"}`) -and in eight tools that the toolbars don't show until they are added from the All Tools drawer (or chosen with -`tool.select`): `anchorEraserBrush`, `extendPath`, `measureInspect`, `parametricShape`, `cornerTool`, `slideAnchor`, -`sharedEdge` and `trimAtCrossings`. -None has a shortcut. Each edit is one undo step, and an edit that changes nothing makes no step. +and in eight tools: `anchorEraserBrush`, `extendPath`, `measureInspect`, `parametricShape`, `cornerTool`, `slideAnchor`, +`sharedEdge` and `trimAtCrossings`. The toolbars don't show the first seven until they are added from the All Tools +drawer (or chosen with `tool.select`); `trimAtCrossings` is in the Scissors tool's group in both shipped toolbars, +after the Knife, and `ui.tool.list` lists it there. A toolbar edited before it joined keeps its saved layout until +Reset Toolbar. None has a shortcut; one can be set in Edit › Keyboard Shortcuts › Tools. Each edit is one undo step, +and an edit that changes nothing makes no step. Tools: @@ -12349,7 +12351,7 @@ Tools: line has at most 4,096 points; past those limits it draws none. Once finding the crossings takes more than a twentieth of the work a release may do, or checking the line against the paths' segments takes more than 1,000,000 box tests, the drag draws none until the next press. A click or a release still removes what it reaches. The tool - has no options. + has no options. Its cursor is the Knife's (`Knife`): a knife whose blade's point is the hotspot. Commands: diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 2cf19591ee..7d36c21f2a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2591,7 +2591,7 @@ A VectorCraft addition, not a feature of the reference app, so no area score mov ## Path Precision Tools add-on: Trim at Crossings (2026-11-13) -A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (kept out of the shipped toolbars, listed in the All Tools drawer, no shortcut) removes stretches of paths between the places where they are crossed by another path or by themselves, on any path that can be edited, selected or not. A click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; each is one undo step, and Escape during a drag removes nothing. A closed path that loses a stretch becomes open, an open path that loses a middle stretch becomes two paths with its appearance in its place in the stacking order, a path that nothing crosses is removed whole, and the stretches that stay get no new anchors. Hidden and locked paths, guides and clipping paths are not trimmed and do not count as crossing. Add Points at / Split at Crossings share the crossing search: segments that meet at an anchor now count where they cross again elsewhere, and with Self Crossings a curved segment that loops over itself crosses itself. Command `addon.pathtools.trim`; `vectorcraft_pathops::addons::pathtools::{crossings_on, spans, without_spans}`. Hovering shows in red the stretch a click would remove, worked out by the same code the command uses (`vectorcraft_tools::addons::trim::plan`), and a drag that reaches at most 32 paths shows what its release would remove; a preview spends at most a twentieth of the crossing work a click may (2026-11-15; tests `hovering_*`, `in_isolation_mode_*`, `a_path_whose_crossings_*` and `a_small_drag_*` in `addons::trim` in `vectorcraft-tools`, `hovering_with_the_tool_shows_the_stretch_its_click_removes` and `what_the_tool_shows_*` in `vectorcraft-engine`). Not yet: crossings with type, images and symbol instances. Tests: `crossings_on_*`, `segments_*`, `a_segment_that_loops_over_itself_crosses_itself`, `one_work_budget_*`, `spans_divide_*`, `a_subpath_without_*` and `a_slice_*` in `addons::pathtools::tests` in `vectorcraft-pathops`, `addons::trim` in `vectorcraft-tools` (click, rectangle, freehand line, Escape), `cmd::addons::pathtools::trim::tests` in `vectorcraft-engine` (a middle and an end stretch, a closed path opening, a rectangle and a line as one undo step, locked and hidden paths, guides and clipping paths, paths nothing crosses, compound path members, the selection, 3,000 other paths, a path too large to search left alone until touched, bad params refused), `the_plugins_submenu_selects_the_tools_and_opens_the_anchor_inspector` in `vectorcraft-ui-egui`, `edit_toolbar::tests` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. +A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (also in the Scissors tool's group in both shipped toolbars, after the Knife, since 2026-11-16; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut) removes stretches of paths between the places where they are crossed by another path or by themselves, on any path that can be edited, selected or not. A click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; each is one undo step, and Escape during a drag removes nothing. A closed path that loses a stretch becomes open, an open path that loses a middle stretch becomes two paths with its appearance in its place in the stacking order, a path that nothing crosses is removed whole, and the stretches that stay get no new anchors. Hidden and locked paths, guides and clipping paths are not trimmed and do not count as crossing. Add Points at / Split at Crossings share the crossing search: segments that meet at an anchor now count where they cross again elsewhere, and with Self Crossings a curved segment that loops over itself crosses itself. Command `addon.pathtools.trim`; `vectorcraft_pathops::addons::pathtools::{crossings_on, spans, without_spans}`. Hovering shows in red the stretch a click would remove, worked out by the same code the command uses (`vectorcraft_tools::addons::trim::plan`), and a drag that reaches at most 32 paths shows what its release would remove; a preview spends at most a twentieth of the crossing work a click may (2026-11-15; tests `hovering_*`, `in_isolation_mode_*`, `a_path_whose_crossings_*` and `a_small_drag_*` in `addons::trim` in `vectorcraft-tools`, `hovering_with_the_tool_shows_the_stretch_its_click_removes` and `what_the_tool_shows_*` in `vectorcraft-engine`). Not yet: crossings with type, images and symbol instances. Tests: `crossings_on_*`, `segments_*`, `a_segment_that_loops_over_itself_crosses_itself`, `one_work_budget_*`, `spans_divide_*`, `a_subpath_without_*` and `a_slice_*` in `addons::pathtools::tests` in `vectorcraft-pathops`, `addons::trim` in `vectorcraft-tools` (click, rectangle, freehand line, Escape), `cmd::addons::pathtools::trim::tests` in `vectorcraft-engine` (a middle and an end stretch, a closed path opening, a rectangle and a line as one undo step, locked and hidden paths, guides and clipping paths, paths nothing crosses, compound path members, the selection, 3,000 other paths, a path too large to search left alone until touched, bad params refused), `the_plugins_submenu_selects_the_tools_and_opens_the_anchor_inspector` in `vectorcraft-ui-egui`, `edit_toolbar::tests` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. The tool shows the Knife's cursor, now drawn as a knife with the blade's point on the hotspot (2026-11-16; tests `trim_at_crossings_is_in_the_scissors_flyout` and `a_saved_toolbar_without_trim_at_crossings_keeps_its_layout` in `edit_toolbar::tests`, `trim_at_crossings_is_in_the_scissors_group_once` in `addons::tests`, `headless_backend_methods` in `vectorcraft-mcp`, `the_knife_shows_a_knife_with_its_point_on_the_hotspot` in `cursors::tests` and `drawing_tools_show_their_own_cursor` in `vectorcraft-tools`). ## Document Tools add-on: Save a Timestamped Copy (2026-11-01) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 4be9bc0731..550da7c469 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -170,6 +170,7 @@ tools, never checked side by side) isn't captured row by row. | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Live Paint Bucket cursors | partial | a filled bucket over a face a click fills, a brush over an edge it paints, an empty bucket where it paints nothing, following Paint Fills, Paint Strokes and Shift; the Eyedropper with Alt; the crosshair with Use Precise Cursors. No cursor swatch preview | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | +| Knife cursor | done | a knife, the blade's point on the hotspot, white blade and black handle, for the Knife and the Trim at Crossings Tool; the crosshair with Use Precise Cursors; `the_knife_shows_a_knife_with_its_point_on_the_hotspot`, `drawing_tools_show_their_own_cursor` | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Eraser: an Alt-drag draws a marquee and the release erases everything inside it (closed shapes lose the rectangle's area, open paths are cut where they cross its edges); Alt+Shift keeps the marquee square; Escape cancels it, and a click erases nothing | done | `path.eraseRegion {rect}`; [public behavior reference](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=133); `eraser_alt_drag_draws_a_marquee_and_erases_the_rectangle`, `eraser_alt_shift_drag_keeps_the_marquee_square`, `eraser_marquee_click_or_escape_erases_nothing`, `erase_region_rect_erases_everything_inside_it`, `erase_region_rect_refuses_bad_values` | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | @@ -484,10 +485,10 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Document Tools add-on (VectorCraft addition): Object › Plug-ins › Document Tools › Batch Trace Folder asks for a folder of images, then a destination folder, traces each image with a preset (optionally expanded) and saves it there as `.vectorcraft`, `.svg`, `.pdf`, `.ai` or `.eps` under its own name (taken names numbered, nothing replaced), closing each image again; the status bar counts the images traced and those that couldn't be; off on the web | done | #4921; `addon.document.batchTraceFolder`, `crates/engine/src/cmd/addons/document/batch_trace.rs`, `crates/ui-egui/src/addons/document.rs` and their tests; not a feature of the reference app | | Document Tools add-on (VectorCraft addition): Object › Plug-ins › Document Tools › New Symbols from Layers makes a symbol of each layer's art named after the layer (the highlighted layers when two or more are, else all); Convert Layers to Symbols also replaces each layer's art with an instance in place; empty layers skipped, one undo step | done | #4927; `addon.document.symbolsFromLayers`, `crates/engine/src/cmd/addons/document.rs`, `crates/ui-egui/src/addons/document.rs` and their tests; not a feature of the reference app, so it is not scored | | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point) | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not a feature of the reference app, so it is not scored | -| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its eight tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path, Shared Edge Merge Tool, Trim at Crossings Tool), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; the Shared Edge Merge Tool shows, over two paths touching at two coincident anchors, the two stretches and the edge merging them, a click merges them (half way; Shift the upper path, Alt the lower), and near anchors meet or an anchor one path lacks is added to match (Shift+Alt asks for this inside a stretch), with a Shared Edges section in the Anchor Inspector (brush diameter, coincidence 0 to 3 pt, Keep Shared Points Together, which takes coincident anchors along with the add-on's own anchor moves); a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored | +| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its eight tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path, Shared Edge Merge Tool, Trim at Crossings Tool), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped (except Trim at Crossings, which both shipped toolbars and the drawer show in the Scissors tool's group), opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; the Shared Edge Merge Tool shows, over two paths touching at two coincident anchors, the two stretches and the edge merging them, a click merges them (half way; Shift the upper path, Alt the lower), and near anchors meet or an anchor one path lacks is added to match (Shift+Alt asks for this inside a stretch), with a Shared Edges section in the Anchor Inspector (brush diameter, coincidence 0 to 3 pt, Keep Shared Points Together, which takes coincident anchors along with the add-on's own anchor moves); a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Divide into Dashes… (Dash and Gap in any unit, Fit to Corners and Ends, Remove Gaps; Preview) cuts the selected paths, or only their direct-selected segments, into open pieces along the curve, keeping their appearance, one undo step | done | #4950; `addon.pathtools.divideDashes`, `crates/pathops/src/addons/pathtools/dashes.rs`, `crates/ui-egui/src/addons/pathtools/dashes.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Set Corners… (also a button in the Anchor Inspector's Corners section: Radius in any unit, Corner kind, Anchors: All, Odd-Numbered or Even-Numbered, counted from each path's first anchor; Angle: from … to …°, only the corners whose sides meet at an angle in that range; Preview) cuts corners on the chosen anchors of every selected path, one undo step | done | #5546, #5545; `addon.pathtools.cornerSet` (`every`, `minAngle`, `maxAngle`), `crates/ui-egui/src/addons/pathtools/set_corners.rs` and their tests; not a feature of the reference app, so it is not scored | -| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (in the All Tools drawer under the add-on's heading, in neither toolbar as shipped, no shortcut) removes stretches of paths between the places where they are crossed, on any editable path, selected or not: a click removes the stretch under the pointer, a drag every stretch its rectangle touches, an Alt-drag every stretch its freehand line crosses; one undo step each; Escape during a drag removes nothing; hovering shows in red the stretch a click would remove, and a drag that reaches few paths shows what its release would remove | done | `addon.pathtools.trim` (in `crates/engine/src/cmd/addons/pathtools/trim.rs`), `crates/tools/src/addons/trim.rs` and their tests; not a feature of the reference app, so it is not scored | +| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Trim at Crossings Tool (also in the Scissors tool's group in both shipped toolbars, after the Knife, and listed there in the All Tools drawer; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut until one is set in Edit › Keyboard Shortcuts › Tools; the Knife's cursor, drawn as a knife with the blade's point on the hotspot) removes stretches of paths between the places where they are crossed, on any editable path, selected or not: a click removes the stretch under the pointer, a drag removes every stretch its rectangle touches, and an Alt-drag removes every stretch its freehand line crosses; one undo step each; Escape during a drag removes nothing; hovering shows in red the stretch a click would remove, and a drag that reaches few paths shows what its release would remove | done | `addon.pathtools.trim` (in `crates/engine/src/cmd/addons/pathtools/trim.rs`), `crates/tools/src/addons/trim.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Expand Dashes into Paths turns each selected path's dashed stroke into separate open paths, one per dash, laid out as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off; one undo step | done | #4922; `addon.pathtools.expandDashes` (in `crates/engine/src/cmd/addons/pathtools.rs`, using the renderer's dash layout) and its tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle… draws the circles that touch two selected paths or compound paths at a radius, or three of them, each touching the outlines without crossing them; Radius (two shapes), a Circle menu (All or one by number) and Preview; one undo step | done | `addon.pathtools.tangentCircle` (in `crates/engine/src/cmd/addons/pathtools/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle.rs`) and its tests; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Effect › Path Effects lists its live effects (Dashes to Geometry, Add Anchors, Extend Path, Close Path, Smooth Anchors, Retract Handles, Reverse Direction, Simplify Anchors, Split at Anchors), each with the effect dialog's live Preview except Reverse Direction, which has no options, and listed in the Appearance panel like any effect | done | `addon.path.*`, `crates/effects/src/addons/path.rs`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored |