diff --git a/crates/ui-egui/src/addons/pathtools/shape.rs b/crates/ui-egui/src/addons/pathtools/shape.rs index 7a666e695e..a8b871f1eb 100644 --- a/crates/ui-egui/src/addons/pathtools/shape.rs +++ b/crates/ui-egui/src/addons/pathtools/shape.rs @@ -2,7 +2,11 @@ //! fields (kind, count, size, rotation, the kind's own values, corner radius), edited with //! `addon.pathtools.shape.set`; with no shape selected, the same fields set the Parametric Shape //! Tool's next shape (`tool.setOption`). Convert turns selected plain shapes into parametric ones. +//! Canceling a field edit or a Shape choice restores its opening value: on a selected shape the +//! edit is one undo step that the cancel takes back, and the tool's next shape keeps its option. +//! For the tool's next shape, a highlighted Shape entry applies only once it is chosen. +use craft::behavior::EditEvents; use craft::ui::buttons::Button; use craft::ui::contract::{Bind, Entry, Props as _, Show as _, Sizing, clicked}; use craft::ui::display::{Divider, Text}; @@ -15,8 +19,9 @@ use vectorcraft_doc::NodeId; use vectorcraft_geom::Point; use vectorcraft_tools::addons::parametric_shape::{self as tool, MAX_COUNT, MAX_SIZE, MIN_COUNT, MIN_SIZE, ParametricShape, ShapeKind, apply, read}; -use super::{row, run, typed}; +use super::{row, run}; use crate::canvas::rulers::general_lengths; +use crate::edits::{EditPath, apply_event}; use crate::panels::empty_state; use crate::{VectorcraftApp, fields}; @@ -82,6 +87,25 @@ pub(super) fn plain_selected(app: &VectorcraftApp) -> bool { app.session.active().is_some_and(|st| !st.selection.is_empty()) && selected(app).is_none() } +/// The params a number field's edits send, `to` of each number it leaves; a cleared field sends none, +/// and its gesture still begins and ends. +fn number(events: EditEvents>, to: impl Fn(f64) -> Value) -> EditEvents> { + events.map(|v| v.map(&to)) +} + +/// Runs `addon.pathtools.shape.set` with `p` on the selected shape `id`. +fn set(app: &mut VectorcraftApp, id: NodeId, p: &Value) { + let mut p = p.clone(); + p["id"] = json!(id.0); + // The Transform panel and the Control bar share one reference point locator. W and H + // keep the point of the shape's bounding box chosen there in place. With anchors + // direct-selected the locator shows their box, so the shape keeps its center instead. + if p.get("width").or_else(|| p.get("height")).is_some() && !anchors_selected(app) { + p["reference"] = json!(app.ui.transform_panel.reference_point); + } + run(app, "addon.pathtools.shape.set", p); +} + pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if app.session.active().is_none() { empty_state(ui, "dc-parametric-shape", tl!("No document"), tl!("Open a document to draw parametric shapes.")); @@ -93,7 +117,8 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if id.is_none() { Text::new(tl!("Select a parametric shape to edit it. With none selected, these set the next shape.")).show(ui); } - let mut change: Option = None; + // Each field's edits this pass, as the params they send. + let mut edits: Vec>> = Vec::new(); let entries: Vec> = ShapeKind::ALL .into_iter() .map(|k| { @@ -101,67 +126,274 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { Entry::new(k, tl!(label)) }) .collect(); - let kind = |ui: &mut Ui| Select::new(tl!("Shape"), Bind::given(s.kind), &entries).show(ui).value().copied(); - if let Some(k) = row(ui, "Shape", "parametric-shape-kind", kind) { - change = Some(json!({ "kind": k.id() })); - } + let kind = |ui: &mut Ui| Some(Select::new(tl!("Shape"), Bind::given(s.kind), &entries).show(ui).events.map(|k| Some(json!({ "kind": k.id() })))); + let shape = row(ui, "Shape", "parametric-shape-kind", kind).unwrap_or_default(); if s.kind.counted() { let count = |ui: &mut Ui| { let field = NumberField::new(tl!("Count"), Bind::given(Some(f64::from(s.count)))).range(f64::from(MIN_COUNT)..=f64::from(MAX_COUNT)); - typed(field.fixed_decimals(0).show(ui).value()) + Some(number(field.fixed_decimals(0).show(ui).edit.events, |v| json!({ "count": v }))) }; - if let Some(v) = row(ui, "Count", "parametric-shape-count", count) { - change = Some(json!({ "count": v })); - } + edits.extend(row(ui, "Count", "parametric-shape-count", count)); } for (label, key, v) in [("W", "width", s.width), ("H", "height", s.height)] { - let size = |ui: &mut Ui| typed(fields::size_field(ui, tl!(label), Some(v), lengths).range(MIN_SIZE..=MAX_SIZE).show(ui).value()); - if let Some(v) = row(ui, label, key, size) { - change = Some(json!({ key: v })); - } + let size = |ui: &mut Ui| { + let field = fields::size_field(ui, tl!(label), Some(v), lengths).range(MIN_SIZE..=MAX_SIZE); + Some(number(field.show(ui).edit.events, |v| json!({ key: v }))) + }; + edits.extend(row(ui, label, key, size)); } let rotation = |ui: &mut Ui| { let field = NumberField::new(tl!("Rotation"), Bind::given(Some(s.rotation))).unit_kind(UnitKind::Degrees); - typed(field.fixed_decimals(1).show(ui).value()) + Some(number(field.fixed_decimals(1).show(ui).edit.events, |v| json!({ "rotation": v }))) }; - if let Some(v) = row(ui, "Rotation", "parametric-shape-rotation", rotation) { - change = Some(json!({ "rotation": v })); - } + edits.extend(row(ui, "Rotation", "parametric-shape-rotation", rotation)); // The kind's own values, as percentages of their fraction. for ((key, v), (range, label)) in [("a", s.a), ("b", s.b)].into_iter().zip(s.kind.values().into_iter().zip(value_labels(s.kind))) { let Some(r) = range else { continue }; let own = |ui: &mut Ui| { let field = NumberField::new(tl!(label), Bind::given(Some(v * 100.0))).range(r.min * 100.0..=r.max * 100.0); - typed(field.unit_kind(UnitKind::Percent).fixed_decimals(0).show(ui).value()) + Some(number(field.unit_kind(UnitKind::Percent).fixed_decimals(0).show(ui).edit.events, |x| json!({ key: x / 100.0 }))) }; - if let Some(x) = row(ui, label, key, own) { - change = Some(json!({ key: x / 100.0 })); - } + edits.extend(row(ui, label, key, own)); } if s.kind.rounds() { - let radius = - |ui: &mut Ui| typed(fields::size_field(ui, tl!("Corner Radius"), Some(s.radius), lengths).range(0.0..=MAX_SIZE).show(ui).value()); - if let Some(v) = row(ui, "Corner Radius", "parametric-shape-radius", radius) { - change = Some(json!({ "radius": v })); - } + let radius = |ui: &mut Ui| { + let field = fields::size_field(ui, tl!("Corner Radius"), Some(s.radius), lengths).range(0.0..=MAX_SIZE); + Some(number(field.show(ui).edit.events, |v| json!({ "radius": v }))) + }; + edits.extend(row(ui, "Corner Radius", "parametric-shape-radius", radius)); } Divider::horizontal().show(ui); let convert = clicked(&Button::new(tl!("Convert to Parametric Shape")).sizing(Sizing::FillWidth).enabled(plain).show(ui)); - match (change, id) { - (Some(mut p), Some(id)) => { - p["id"] = json!(id.0); - // The Transform panel and the Control bar share one reference point locator. W and H - // keep the point of the shape's bounding box chosen there in place. With anchors - // direct-selected the locator shows their box, so the shape keeps its center instead. - if p.get("width").or_else(|| p.get("height")).is_some() && !anchors_selected(app) { - p["reference"] = json!(app.ui.transform_panel.reference_point); + match id { + // One undo step per gesture; a cancel reverts it. + Some(id) => { + for event in shape.iter().chain(edits.iter().flatten()) { + apply_event(app, event, &EditPath::Scope, &mut |app, p: &Option, _| { + if let Some(p) = p { + set(app, id, p); + } + }); + } + } + // The value each field holds after its events: a cancel's is the opening value. A Shape entry + // applies once it is chosen, since a new kind resets the kind's own count and values. + None => { + for values in shape.committed().into_iter().chain(edits.iter().filter_map(EditEvents::landed)).flatten() { + run(app, "tool.setOption", json!({ "tool": tool::ID, "values": values })); } - run(app, "addon.pathtools.shape.set", p); } - (Some(values), None) => run(app, "tool.setOption", json!({ "tool": tool::ID, "values": values })), - (None, _) => {} } if convert { run(app, "addon.pathtools.shape.convert", json!({})); } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::tests::panel_harness::Panel; + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + use vectorcraft_tools::{PointerEvent, PointerKind}; + + /// The text fields with what each test types: the tool kind that shows the field, its label, its option key and + /// the text typed. + const TYPED: [(&str, &str, &str, &str); 7] = [ + ("gear", "W", "width", "160"), + ("gear", "H", "height", "40"), + ("gear", "Count", "count", "9"), + ("gear", "Rotation", "rotation", "30"), + ("gear", "Tooth Height", "a", "50"), + ("arrow", "Shaft", "b", "70"), + ("gear", "Corner Radius", "radius", "7"), + ]; + + fn app(kind: &str) -> VectorcraftApp { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app.run("tool.setOption", json!({"tool": tool::ID, "values": {"kind": kind}})).unwrap(); + app + } + + /// `app` with a shape of `kind` drawn and selected. + fn app_with_shape(kind: &str) -> (VectorcraftApp, NodeId) { + let mut app = app(kind); + let params = json!({"kind": kind, "center": [150, 150], "width": 100, "height": 80, "radius": 2}); + let id = NodeId(app.run("addon.pathtools.shape.create", params).unwrap()["id"].as_u64().unwrap()); + (app, id) + } + + fn shape_of(app: &VectorcraftApp, id: NodeId) -> ParametricShape { + app.session.active().and_then(|st| st.doc.node(id)).and_then(read).unwrap() + } + + fn undo_len(app: &VectorcraftApp) -> usize { + app.session.active().unwrap().history.undo.len() + } + + /// The tool's next shape from the tool options `options`. + fn next_shape(options: &Value) -> ParametricShape { + let fallback = ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0); + apply(fallback, options).unwrap() + } + + /// Double-clicks the canvas with the Parametric Shape Tool and answers the shape it places. + fn draw_next(app: &mut VectorcraftApp) -> ParametricShape { + app.run("select.set", json!({"ids": []})).unwrap(); + app.select_tool(tool::ID); + let view = app.view_info(); + crate::canvas::dispatch(app, &PointerEvent::new(PointerKind::DoubleClick, 150.0, 150.0), view); + let (_, shape) = selected(app).expect("the double-click places a selected parametric shape"); + shape + } + + #[test] + fn canceling_a_next_shape_field_restores_the_tool_option_and_enter_keeps_it() { + for (kind, label, key, text) in TYPED { + for cancel in [false, true] { + let mut panel = Panel::new(app(kind), show); + let before = panel.app().session.tool_options_of(tool::ID); + let doc = panel.app().session.active().unwrap().doc.clone(); + let undo = undo_len(&panel.app()); + panel.click_role(label, Role::SPIN_BUTTON); + panel.key(Key::A, Modifiers::COMMAND); + panel.type_text(text); + panel.frame(); + let proposed = panel.app().session.tool_options_of(tool::ID); + assert_ne!(proposed[key], before[key], "{label} changes the next shape while typing"); + if cancel { + panel.key(Key::Escape, Modifiers::NONE); + assert_eq!(panel.app().session.tool_options_of(tool::ID), before, "{label} restores on Escape"); + } else { + panel.key(Key::Enter, Modifiers::NONE); + } + panel.frame(); + let kept = if cancel { before.clone() } else { proposed.clone() }; + assert_eq!(panel.app().session.tool_options_of(tool::ID), kept, "{label}, canceled: {cancel}"); + assert!(panel.shows(label), "{label}: the panel stays open"); + let mut app = panel.app(); + assert_eq!(app.session.active().unwrap().doc, doc, "{label} only changes the tool's next shape"); + assert_eq!(undo_len(&app), undo, "{label} adds no undo step"); + let drawn = draw_next(&mut app); + assert_eq!(drawn, ParametricShape { center: drawn.center, ..next_shape(&kept) }, "{label}: the next shape drawn"); + } + } + } + + #[test] + fn canceling_a_next_shape_kind_keeps_the_tool_options_and_enter_chooses_it() { + let mut app = app("gear"); + app.run("tool.setOption", json!({"tool": tool::ID, "values": {"count": 9, "a": 0.5}})).unwrap(); + let mut panel = Panel::new(app, show); + let before = panel.app().session.tool_options_of(tool::ID); + panel.click_role("Shape", Role::COMBO_BOX); + panel.key(Key::ArrowDown, Modifiers::NONE); + panel.frame(); + assert_eq!(panel.app().session.tool_options_of(tool::ID), before, "a highlighted entry is not applied before it is chosen"); + panel.key(Key::Escape, Modifiers::NONE); + panel.frame(); + assert_eq!(panel.app().session.tool_options_of(tool::ID), before, "Escape keeps the next shape's kind, count and values"); + assert!(panel.shows("Shape"), "the panel stays open"); + { + let mut app = panel.app(); + let drawn = draw_next(&mut app); + assert_eq!(drawn, ParametricShape { center: drawn.center, ..next_shape(&before) }, "the next shape drawn keeps the earlier options"); + assert_eq!((drawn.kind, drawn.count), (ShapeKind::Gear, 9)); + app.select_tool("selection"); + app.run("select.set", json!({"ids": []})).unwrap(); + } + panel.frame(); + panel.click_role("Shape", Role::COMBO_BOX); + panel.key(Key::ArrowDown, Modifiers::NONE); + panel.key(Key::Enter, Modifiers::NONE); + panel.frame(); + let chosen = panel.app().session.tool_options_of(tool::ID); + assert_eq!(chosen["kind"], json!("bubble"), "Enter chooses the highlighted kind"); + } + + #[test] + fn canceling_a_selected_shape_field_restores_the_shape_and_enter_is_one_undo_step() { + for (kind, label, _, text) in TYPED { + for cancel in [false, true] { + let (app, id) = app_with_shape(kind); + let mut panel = Panel::new(app, show); + let options = panel.app().session.tool_options_of(tool::ID); + let doc = panel.app().session.active().unwrap().doc.clone(); + let before = shape_of(&panel.app(), id); + let undo = undo_len(&panel.app()); + panel.click_role(label, Role::SPIN_BUTTON); + panel.key(Key::A, Modifiers::COMMAND); + panel.type_text(text); + panel.frame(); + let proposed = shape_of(&panel.app(), id); + assert_ne!(proposed, before, "{label} changes the shape while typing"); + if cancel { + panel.key(Key::Escape, Modifiers::NONE); + } else { + panel.key(Key::Enter, Modifiers::NONE); + } + panel.frame(); + assert!(panel.shows(label), "{label}: the panel stays open"); + let app = panel.app(); + if cancel { + assert_eq!(shape_of(&app, id), before, "{label} restores the shape on Escape"); + assert_eq!(app.session.active().unwrap().doc, doc, "{label}: Escape leaves the document as it was"); + assert_eq!(undo_len(&app), undo, "{label}: Escape leaves no undo step"); + } else { + assert_eq!(shape_of(&app, id), proposed, "{label}: Enter keeps the edit"); + assert_eq!(undo_len(&app), undo + 1, "{label}: the edit is one undo step"); + } + assert_eq!(app.session.tool_options_of(tool::ID), options, "{label} leaves the tool's next shape alone"); + } + } + } + + #[test] + fn a_selected_shape_field_left_empty_ends_its_undo_step() { + let (app, id) = app_with_shape("gear"); + let mut panel = Panel::new(app, show); + let undo = undo_len(&panel.app()); + panel.click_role("W", Role::SPIN_BUTTON); + panel.key(Key::A, Modifiers::COMMAND); + panel.type_text("160"); + panel.frame(); + let typed = shape_of(&panel.app(), id); + assert!((typed.width - 160.0).abs() < 1e-9, "W changes the shape while typing: {typed:?}"); + panel.key(Key::A, Modifiers::COMMAND); + panel.key(Key::Backspace, Modifiers::NONE); + panel.key(Key::Enter, Modifiers::NONE); + panel.frame(); + let mut app = panel.app(); + assert_eq!(shape_of(&app, id), typed, "an empty field leaves the last width"); + assert_eq!(undo_len(&app), undo + 1, "the edit is one undo step"); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 40, "height": 40})).unwrap(); + assert_eq!(undo_len(&app), undo + 2, "the next edit is a step of its own"); + } + + #[test] + fn canceling_a_selected_shape_kind_restores_the_shape_and_enter_is_one_undo_step() { + for cancel in [false, true] { + let (app, id) = app_with_shape("gear"); + let mut panel = Panel::new(app, show); + let before = shape_of(&panel.app(), id); + let undo = undo_len(&panel.app()); + panel.click_role("Shape", Role::COMBO_BOX); + panel.key(Key::ArrowDown, Modifiers::NONE); + panel.frame(); + let proposed = shape_of(&panel.app(), id); + assert_ne!(proposed.kind, before.kind, "the highlighted entry previews the kind"); + panel.key(if cancel { Key::Escape } else { Key::Enter }, Modifiers::NONE); + panel.frame(); + assert!(panel.shows("Shape"), "the panel stays open"); + let app = panel.app(); + if cancel { + assert_eq!(shape_of(&app, id), before, "Escape restores the kind"); + assert_eq!(undo_len(&app), undo, "Escape leaves no undo step"); + } else { + assert_eq!(shape_of(&app, id).kind, proposed.kind, "Enter keeps the kind"); + assert_eq!(undo_len(&app), undo + 1, "the choice is one undo step"); + } + } + } +} diff --git a/docs/mcp.md b/docs/mcp.md index c5a47e102a..657198e20e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -15898,6 +15898,9 @@ Tools: `addon.pathtools.shape.set`. A double-click on the canvas places a shape with the last settings. A new shape's center and the point dragged out from it snap as drawn points do. Options (`tool.setOption`, or the panel with no shape selected) are the next shape's numbers, as the commands take them. + Canceling a Parametric Shape panel edit or Shape menu choice restores its opening value: a selected shape's edit is + one undo step that the cancel takes back, and with no shape selected the tool keeps its opening option. With no + shape selected, a highlighted Shape menu entry applies only once it is chosen. - **Corner Tool** (`cornerTool`, or the UI command `addon.pathtools.cornerTool`, which also shows the Anchor Inspector panel with its Corners section): edits the app's Live Corners on any path, selected or not. Over an anchor where two sides meet at an angle the anchor shows; a click runs `addon.pathtools.cornerSet` with the tool's `radius` (pt, 10) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 4884e4672c..2bf62cc6e7 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -571,6 +571,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool (also in the Pen tool's group in both shipped toolbars, after the Quick Pen; the All Tools drawer lists it under Draw; a toolbar edited before keeps its saved layout until Reset Toolbar; 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 nine tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path, Shared Edge Merge Tool, Tangent Circle 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, Extend Path or Tangent Circle 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 | | Corner and Shared Edge Merge options restore canceled edits | done | Canceling a control gesture restores its opening draft values. Confirmed changes remain available to the tool. | +| Parametric Shape panel restores canceled edits | done | Canceling a field edit or Shape menu choice restores the selected shape, with no undo step, or the tool's next shape. An accepted edit of a selected shape is one undo step. With no shape selected, a highlighted Shape entry applies only once chosen. | | 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 (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 |