diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 865adcc282..a6d1fe6c5d 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -1569,6 +1569,16 @@ fn headless_backend_methods() { 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); + // The Enclosing Lasso Tool is listed once, in the Lasso tool's group after the Lasso. + let enclosing = vectorcraft_tools::addons::enclosing_lasso::ID; + let with_enclosing: Vec<_> = + groups.iter().map(|group| group.as_array().unwrap()).filter(|group| group.iter().any(|entry| entry["id"] == enclosing)).collect(); + assert_eq!(with_enclosing.len(), 1, "{enclosing} is in one group"); + let ids: Vec<_> = with_enclosing[0].iter().map(|entry| entry["id"].clone()).collect(); + assert_eq!(ids, [json!("lasso"), json!(enclosing)]); + assert_eq!(with_enclosing[0][1]["label"], "Enclosing Lasso Tool"); + assert!(with_enclosing[0][1]["shortcut"].is_null()); + assert_eq!(h.call("ui.tool.select", json!({"tool": enclosing})).unwrap()["tool"], enclosing); 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 c75a73882a..ca8645ffc8 100644 --- a/crates/tools/src/addons.rs +++ b/crates/tools/src/addons.rs @@ -1,8 +1,9 @@ //! 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. 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. +//! submenu selects them. Tool gestures emit engine commands. Two tools are the exceptions: the Trim +//! at Crossings Tool is in the Scissors tool's group and the Enclosing Lasso Tool is in the Lasso +//! tool's group ([`crate::TOOL_GROUPS`]), where the toolbars and the All Tools drawer show them, as +//! well as in their add-ons' submenus. pub mod anchor_eraser; pub mod box3d; @@ -37,25 +38,17 @@ pub const SMART_PEN: &[ToolInfo] = &[ToolInfo { id: smart_pen::ID, label: "Smart pub const CONTOUR: &[ToolInfo] = &[ToolInfo { id: contour::ID, label: "Contour Tool", shortcut: None, icon: "tool-contour" }]; -pub const ENCLOSING_LASSO: &[ToolInfo] = &[ToolInfo { id: enclosing_lasso::ID, label: "Enclosing Lasso Tool", shortcut: None, icon: "tool-lasso" }]; - pub const BOX_3D: &[ToolInfo] = &[ToolInfo { id: box3d::ID, label: "3D Box Tool", shortcut: None, icon: "box" }]; pub const POLYGONAL_LASSO: &[ToolInfo] = &[ToolInfo { id: polygonal_lasso::ID, label: "Polygonal Lasso Tool", shortcut: None, icon: "tool-lasso" }]; /// The add-ons' tool groups, after the toolbar's own ([`crate::TOOL_GROUPS`]), each with the /// heading the All Tools drawer lists it under (its add-on's name). -const HEADED: &[(&[ToolInfo], &str)] = &[ - (PATH_TOOLS, "Path Precision Tools"), - (SMART_PEN, "Smart Pen"), - (ENCLOSING_LASSO, "Enclosing Lasso"), - (CONTOUR, "Contour"), - (BOX_3D, "3D Box"), - (POLYGONAL_LASSO, "Polygonal Lasso"), -]; +const HEADED: &[(&[ToolInfo], &str)] = + &[(PATH_TOOLS, "Path Precision Tools"), (SMART_PEN, "Smart Pen"), (CONTOUR, "Contour"), (BOX_3D, "3D Box"), (POLYGONAL_LASSO, "Polygonal Lasso")]; /// The add-ons' tool groups, after the toolbar's own ([`crate::TOOL_GROUPS`]). -pub const GROUPS: &[&[ToolInfo]] = &[PATH_TOOLS, SMART_PEN, ENCLOSING_LASSO, CONTOUR, BOX_3D, POLYGONAL_LASSO]; +pub const GROUPS: &[&[ToolInfo]] = &[PATH_TOOLS, SMART_PEN, CONTOUR, BOX_3D, POLYGONAL_LASSO]; /// The heading the All Tools drawer lists tool `id` under: its add-on's name. pub fn heading(id: &str) -> Option<&'static str> { @@ -97,7 +90,6 @@ mod tests { } assert!(PATH_TOOLS.iter().all(|t| heading(t.id) == Some("Path Precision Tools"))); assert_eq!(heading(smart_pen::ID), Some("Smart Pen")); - assert_eq!(heading(enclosing_lasso::ID), Some("Enclosing Lasso")); assert_eq!(heading(contour::ID), Some("Contour")); assert_eq!(heading(box3d::ID), Some("3D Box")); assert_eq!(heading(polygonal_lasso::ID), Some("Polygonal Lasso")); @@ -122,4 +114,21 @@ mod tests { 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); } + + /// The Enclosing Lasso Tool is in the Lasso tool's group, right after the Lasso, with no + /// default shortcut, listed once, and still made by its add-on. + #[test] + fn enclosing_lasso_is_in_the_lasso_group_once() { + let id = enclosing_lasso::ID; + let groups: Vec<_> = crate::TOOL_GROUPS.iter().filter(|g| g.iter().any(|t| t.id == id)).collect(); + assert_eq!(groups.len(), 1); + let ids: Vec<_> = groups[0].iter().map(|t| t.id).collect(); + assert_eq!(ids, ["lasso", id]); + let info = crate::tool_info(id).expect("catalogued"); + assert_eq!((info.label, info.shortcut, info.icon), ("Enclosing Lasso Tool", None, "tool-lasso")); + assert_eq!(crate::tool_info("lasso").and_then(|t| t.shortcut), Some("Q"), "the Lasso keeps its shortcut"); + assert_eq!(create(id).map(|tool| tool.id()), Some(id)); + assert!(heading(id).is_none(), "not listed again under the add-on"); + assert_eq!(crate::catalog::all_tools().filter(|t| t.id == id).count(), 1); + } } diff --git a/crates/tools/src/catalog.rs b/crates/tools/src/catalog.rs index 386dfeb4a5..529aa80d18 100644 --- a/crates/tools/src/catalog.rs +++ b/crates/tools/src/catalog.rs @@ -24,7 +24,11 @@ pub const TOOL_GROUPS: &[&[ToolInfo]] = &[ t("groupSelection", "Group Selection Tool", None, "tool-group-select"), ], &[t("magicWand", "Magic Wand Tool", Some("Y"), "tool-magic-wand")], - &[t("lasso", "Lasso Tool", Some("Q"), "tool-lasso")], + &[ + t("lasso", "Lasso Tool", Some("Q"), "tool-lasso"), + // Enclosing Lasso's tool, kept out of `addons::GROUPS` so that `all_tools` lists it once. + t(crate::addons::enclosing_lasso::ID, "Enclosing Lasso Tool", None, "tool-lasso"), + ], &[ t("pen", "Pen Tool", Some("P"), "tool-pen"), t("addAnchor", "Add Anchor Point Tool", Some("+"), "tool-pen-add"), diff --git a/crates/ui-egui/src/edit_toolbar/tests.rs b/crates/ui-egui/src/edit_toolbar/tests.rs index ecb6f15ea9..8983199324 100644 --- a/crates/ui-egui/src/edit_toolbar/tests.rs +++ b/crates/ui-egui/src/edit_toolbar/tests.rs @@ -142,17 +142,52 @@ fn every_tool_is_listed_once_under_a_heading() { assert!(!heads.contains(&"More"), "every tool has a named heading: {heads:?}"); } +/// The Enclosing Lasso Tool is in the Lasso tool's flyout in both toolbars, right after the Lasso, +/// once in the All Tools drawer (under Select) and in Keyboard Shortcuts' list, with no shortcut; +/// Reset Toolbar keeps it there. #[test] -fn enclosing_lasso_is_an_optional_addon_tool() { +fn enclosing_lasso_is_in_the_lasso_flyout() { let mut app = app(); let id = vectorcraft_tools::addons::enclosing_lasso::ID; - assert_eq!(heading(id), "Enclosing Lasso"); - assert!(slot_of(&app, id).is_none()); - app.run("toolbar.addTool", json!({"tool": id})).unwrap(); - assert!(slot_of(&app, id).is_some()); + for advanced in [false, true] { + if advanced { + app.run("window.toolbarAdvanced", json!({})).unwrap(); + } + let s = slots(&app); + let slot = slot_of(&app, "lasso").map(|i| s[i].clone()).expect("a Lasso slot"); + let lasso = slot.iter().position(|t| *t == "lasso").expect("the Lasso"); + assert_eq!(slot.get(lasso + 1), Some(&id), "advanced: {advanced}"); + assert_eq!(s.iter().filter(|ids| ids.contains(&id)).count(), 1, "advanced: {advanced}"); + } + assert_eq!(heading(id), "Select"); + assert_eq!(sections().iter().flat_map(|(_, tools)| tools.iter()).filter(|t| t.id == id).count(), 1, "listed once in the drawer"); + assert_eq!(vectorcraft_tools::catalog::all_tools().filter(|t| t.id == id).count(), 1, "listed once for Keyboard Shortcuts"); + assert_eq!(vectorcraft_tools::tool_info(id).map(|t| (t.label, t.shortcut)), Some(("Enclosing Lasso Tool", None))); app.run("tool.select", json!({"tool": id})).unwrap(); + assert_eq!(app.session.tool_id(), id); + let shown = slot_of(&app, id).map(|i| crate::toolbar::shown_tool(&app, &slots(&app)[i])); + assert_eq!(shown, Some(id), "the slot's button shows the tool once chosen"); + app.run("toolbar.removeTool", json!({"tool": id})).unwrap(); + assert!(slot_of(&app, id).is_none(), "it can be taken out"); app.run("toolbar.reset", json!({})).unwrap(); + let after_reset = slot_of(&app, "lasso").map(|i| slots(&app)[i].contains(&id)); + assert_eq!(after_reset, Some(true), "Reset Toolbar puts it back"); +} + +/// A toolbar edited and saved before the Enclosing Lasso Tool joined the Lasso 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_enclosing_lasso_keeps_its_layout() { + let mut app = app(); + let id = vectorcraft_tools::addons::enclosing_lasso::ID; + let saved = ToolbarCategory { name: Some("Select".into()), slots: vec![["lasso", "magicWand"].iter().map(|t| t.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), [["lasso", "magicWand"]]); assert!(slot_of(&app, id).is_none()); + app.run("toolbar.reset", json!({})).unwrap(); + let slot = slot_of(&app, "lasso").map(|i| slots(&app)[i].clone()); + assert!(slot.is_some_and(|s| s.contains(&id)), "Reset Toolbar adds it"); } #[test] @@ -166,7 +201,7 @@ fn the_commands_add_move_remove_and_reset_tools() { // Before the first slot, moved out of its group. app.run("toolbar.addTool", json!({"tool": "magicWand", "slot": 0})).unwrap(); assert_eq!(&slots(&app)[..3], [&["magicWand"][..], &["selection"], &["directSelection", "groupSelection"]]); - assert_eq!(slots(&app)[3], ["lasso"]); + assert_eq!(slots(&app)[3], ["lasso", "enclosingLasso"]); // After a slot, and into a group (last), moved out of the Rectangle group. app.run("toolbar.addTool", json!({"tool": "slice", "slot": 1, "place": "after"})).unwrap(); assert_eq!(slots(&app)[2], ["slice"]); @@ -359,7 +394,7 @@ fn tools_drag_between_the_drawer_and_the_toolbar() { // Within the toolbar: Selection onto the divider over the Lasso. let tools = crate::toolbar::tests::widget_rects(&ctx, BUTTON); drag(&mut app, &ctx, 5.0, tools[0].center(), tools[2].center_top() + vec2(0.0, 3.0)); - assert_eq!(&slots(&app)[..3], [&["directSelection", "groupSelection"][..], &["selection"], &["lasso", "magicWand"]]); + assert_eq!(&slots(&app)[..3], [&["directSelection", "groupSelection"][..], &["selection"], &["lasso", "enclosingLasso", "magicWand"]]); // The drawer closed, the toolbar is locked: the same drag moves nothing. app.run("window.editToolbar", json!({"open": false})).unwrap(); frame(&mut app, &ctx, 6.0, vec![]); @@ -677,12 +712,11 @@ fn a_saved_toolbar_without_trim_at_crossings_keeps_its_layout() { } /// 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. +/// Scissors tool's group, and the Enclosing Lasso Tool, in the Lasso 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(); - let enclosing = vectorcraft_tools::addons::enclosing_lasso::ID; let contour = vectorcraft_tools::addons::contour::ID; let box3d = vectorcraft_tools::addons::box3d::ID; let polygonal = vectorcraft_tools::addons::polygonal_lasso::ID; @@ -698,7 +732,6 @@ fn addon_tools_are_in_the_drawer_not_the_toolbars() { "slideAnchor", "sharedEdge", "smartPen", - enclosing, contour, box3d, polygonal @@ -715,11 +748,10 @@ fn addon_tools_are_in_the_drawer_not_the_toolbars() { }; 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]))); assert_eq!(listed(box3d), Some(("3D Box", vec![box3d]))); assert_eq!(listed(polygonal), Some(("Polygonal Lasso", vec![polygonal]))); - for tool in ["extendPath", "smartPen", enclosing, contour, box3d, polygonal] { + for tool in ["extendPath", "smartPen", contour, box3d, polygonal] { app.run("toolbar.addTool", json!({"tool": tool})).unwrap(); assert!(slot_of(&app, tool).is_some(), "{tool}"); } diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 8afa8f571a..56de30acff 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -33,7 +33,7 @@ const STRIP_BUTTON: egui::Vec2 = vec2(32.0, PITCH); /// The Basic toolbar: (category, slots); each slot is a flyout group (first = default). pub const BASIC: &[(&str, &[&[&str]])] = &[ - ("Select", &[&["selection"], &["directSelection", "groupSelection"], &["lasso", "magicWand"]]), + ("Select", &[&["selection"], &["directSelection", "groupSelection"], &["lasso", "enclosingLasso", "magicWand"]]), ( "Shapes", &[ diff --git a/crates/ui-egui/src/toolbar/tests.rs b/crates/ui-egui/src/toolbar/tests.rs index d13b47a0db..37613c72e8 100644 --- a/crates/ui-egui/src/toolbar/tests.rs +++ b/crates/ui-egui/src/toolbar/tests.rs @@ -102,7 +102,7 @@ fn the_tool_buttons_are_centred_in_the_panel() { fn saved_flyout_choices_must_still_belong_to_the_slot() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); - for (saved, shown) in [(vectorcraft_tools::addons::enclosing_lasso::ID, "lasso"), ("magicWand", "magicWand")] { + for (saved, shown) in [(vectorcraft_tools::addons::polygonal_lasso::ID, "lasso"), ("magicWand", "magicWand")] { app.ui.slot_tool.insert("lasso".into(), saved.into()); let tree = tree(|ui| show(&mut app, ui)); assert_eq!(role_and_state(&tree, &tip(tool_info(shown).unwrap())), (Role::Button, Some(Toggled::False))); diff --git a/docs/roadmap.md b/docs/roadmap.md index 258b86d04a..9c03b39871 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -37,8 +37,8 @@ Window → Help Bar toggles the bottom tool-help strip independently of the stat **Feature evidence last updated:** 2026-11-03. M1 selection: Enclosing Lasso selects whole objects enclosed by a freehand loop. It is an add-on -under Object › Plug-ins and has its own heading in All Tools. It has no default shortcut or Basic -toolbar slot. Shift adds and Alt subtracts enclosed objects; Escape cancels the loop. +under Object › Plug-ins, and its tool is also in the Lasso tool's group in both shipped toolbars, +after the Lasso. It has no default shortcut. Shift adds and Alt subtracts enclosed objects; Escape cancels the loop. This is a VectorCraft addition; milestone estimates and parity scores are unchanged. The shared assessment status line and revision history are current upstream; this dated section records the submission's feature evidence and revisions without rescoring upstream or claiming a new combined build or runtime measurement. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index db61a96f73..74da2bd640 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1197,7 +1197,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur With the Selection or Group Selection tool, pressing E while dragging a marquee makes the marquee select only the objects that lie entirely inside it. Pressing E again switches the marquee back to its default selection. With members of a group selected whole (with Group Selection, for example), a Selection-tool press on one of them keeps the selection: the pointer shows Move, a drag moves only the selected members (Shift constrains it), a Shift-click takes the pressed member out of the selection, and Alt over it shows no Distance Guides. A press on a member that is not selected, or only partly selected, still selects the outermost group ([Select objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/select-objects.html)). Test: `select::tests::a_press_on_a_selected_member_of_a_group_moves_the_selected_members`. The Lasso picks anchor points only on art a click can pick, and the Add Anchor Point, Delete Anchor Point, Anchor Point and Scissors tools pick anchor points and segments only on the selected paths and on art a click can pick: not on a Shaper Group's original shapes outside Construction mode, and in isolation mode only inside the isolated group or object. Smart Guides and Snap to Point do not snap to a Shaper Group's original shapes, and the reference point of the transform tools snaps to one only when it is selected, or under the pointer in Construction mode. - Enclosing Lasso provides whole-object enclosure selection under Object › Plug-ins and its own heading in All Tools. It has no default shortcut or Basic toolbar slot. It follows path curves and keeps partially enclosed objects out, including objects crossing a concave part of the loop. Ordinary group members can be selected individually; compound paths remain whole. This is a VectorCraft addition; scores and estimates are unchanged. + Enclosing Lasso provides whole-object enclosure selection under Object › Plug-ins. Its tool is also in the Lasso tool's group in both shipped toolbars, after the Lasso, and All Tools lists it there, under Select; a toolbar edited before it joined keeps its saved layout until Reset Toolbar (tests `enclosing_lasso_is_in_the_lasso_flyout` and `a_saved_toolbar_without_enclosing_lasso_keeps_its_layout` in `edit_toolbar::tests`, `enclosing_lasso_is_in_the_lasso_group_once` in `addons::tests`, `headless_backend_methods` in `vectorcraft-mcp`). It has no default shortcut. It follows path curves and keeps partially enclosed objects out, including objects crossing a concave part of the loop. Ordinary group members can be selected individually; compound paths remain whole. This is a VectorCraft addition; scores and estimates are unchanged. Polygonal Lasso selects anchor points (and gradient mesh points) inside a straight-edged loop, with the Lasso's rule for which points are inside, and is listed under Object › Plug-ins and under its own heading in All Tools. It has no default shortcut or Basic toolbar slot. Each click sets a vertex. A double-click, Enter or a click on the first vertex closes the loop, Backspace or Delete removes the last vertex, Escape drops the loop, and Shift keeps the next segment to 45° steps. Shift or Alt held at the first click adds to or subtracts from the selection. This is a VectorCraft addition; scores and estimates are unchanged. Select by Artboards (Object › Plug-ins › Selection Tools, a VectorCraft addition: #5525, #5548, #5549) selects the objects overlapping, fully inside or fully outside one or more chosen artboards (`addon.select.byArtboards {artboards, relation}`). Overlapping is All on Active Artboard's test, shared as `select::on_artboard`; Fully inside means within one artboard, edges included; Fully outside means on none. It looks at what Select All takes, so hidden, locked and locked-artboard art stays out. Its dialog lists each artboard's number, name and size in the document's units, filters by name, chooses rows with click, Shift-click and Cmd/Ctrl-click, and fits a row's artboard in the window on double-click (`view.goToArtboard`). Tests: `crates/engine/src/cmd/addons/select/tests.rs`, `crates/ui-egui/src/addons/select/tests.rs`, `crates/engine/tests/command_sweep.rs`. Select by Link Status (Object › Plug-ins › Selection Tools and the Links panel menu, a VectorCraft addition: #5526) selects the image objects and placed documents whose link is linked (its file found unchanged), embedded, missing or modified, as `links.list` reports it (`addon.select.byLinkStatus {status, ids?, add?, zoom?}`); Select Linked, Embedded, Missing and Modified are off when no image has that status and add to the selection with Shift. Objects that are hidden or locked, inside a hidden or locked object or layer, on a template layer, on a locked artboard, or outside the isolated group are left out (the `select::is_selectable` test) and returned with the reason, and the status bar says how many, in plural forms of every catalog. Select by Link Status… lists each image and placed document with its name, status and format, searches by name, filters by status, picks rows with checkboxes and All / None, and zooms to the selection with the existing Zoom to Selection (`addon.arrange.zoomSelection`). Missing-link markers on the canvas are #5547. Tests: `crates/engine/src/cmd/addons/select/tests.rs` (`by_link_status`), `crates/ui-egui/src/addons/select/link_status/tests.rs`, `crates/engine/tests/command_sweep.rs`. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b312abae1b..6c3c28da91 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -31,8 +31,10 @@ Window → Help Bar toggles the bottom tool-help strip independently of the stat **Feature evidence last updated:** 2026-11-03. -Enclosing Lasso is an add-on under Object › Plug-ins with its own heading in All Tools. It has -no default shortcut or Basic toolbar slot. It selects whole objects only +Enclosing Lasso is an add-on under Object › Plug-ins. Its tool is also in the Lasso tool's group +in both shipped toolbars, after the Lasso, and All Tools lists it there, under Select. A toolbar +edited before it joined keeps its saved layout until Reset Toolbar. It has no default shortcut; +one can be set in Edit › Keyboard Shortcuts › Tools. It selects whole objects only when their geometry is fully enclosed by the freehand loop. Shift adds, Alt subtracts, and Escape cancels. Ordinary group members can be selected separately; compound paths stay whole. Path checks follow curves, excluding stroke width and effects; other objects use their geometric