Selection Tools: Edit Points Only narrows a Direct Selection to its anchor points

addon.select.editPointsOnly {segmentEnds?} turns the current selection into
one that holds only anchor points, so a move or transform that follows acts
on the points alone. Selected segments leave the selection, and the points
at their ends leave it too unless segmentEnds is true. Paths selected whole
keep every point. A group or compound path selected whole gives way to the
visible, unlocked paths inside it (no Shaper Group originals, and no guide
paths while guides are locked). Type, images, symbols and other objects
without anchor points leave the selection.

Only the selection changes, so there is no undo step. With nothing selected
or nothing left to keep it is an error and the selection stays as it was.
The command is on the plug-in allowed list.

Object > Plug-ins > Selection Tools > Edit Points Only... opens a dialog
with Keep Ends of Selected Segments; it previews the narrowed selection on
the canvas, OK keeps it and Cancel puts the selection back.

Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
dotCooCoo committed 2026-11-29 09:21:40 -08:00
1 parent 3ad283b9b0
commit b19aac26ec
10 files changed
+444 -7

No files matched your search

+117 -5
View File
@@ -1,17 +1,19 @@
//! Selection Tools (`addon.select.*`), a built-in add-on: Select by Artboards selects the objects
//! overlapping, fully inside or fully outside one or more chosen artboards (#5525), and Select by
//! Link Status selects the images and placed documents whose file is linked, embedded, missing or
//! modified (#5526), saying which ones it had to leave out and why. Its submenu (Object › Plug-ins
//! › Selection Tools), the Links panel's menu items and the dialogs are the UI's.
//! modified (#5526), saying which ones it had to leave out and why. Edit Points Only narrows the
//! selection to the anchor points selected in it, dropping selected segments and objects without
//! anchor points. Its submenu (Object › Plug-ins › Selection Tools), the Links panel's menu items
//! and the dialogs are the UI's.
#[cfg(test)]
mod tests;
use std::collections::BTreeSet;
use std::collections::{BTreeMap, BTreeSet, HashSet};
use serde_json::{Value, json};
use vectorcraft_doc::{LockedArtboards, Node, NodeId, NodeKind};
use vectorcraft_geom::Point;
use vectorcraft_doc::{AnchorRef, LockedArtboards, Node, NodeId, NodeKind};
use vectorcraft_geom::{PathData, Point};
use super::super::links::{Status, statuses};
use super::super::panelcmds::listed_artboards;
@@ -47,6 +49,15 @@ pub fn specs() -> Vec<CommandSpec> {
has_doc,
by_link_status
),
cmd!(
"addon.select.editPointsOnly",
"Edit Points Only",
["Object", "Plug-ins", "Selection Tools"],
None,
"{segmentEnds?: false (true: the points at the ends of each selected segment stay selected, as anchor points)} narrow the selection to the anchor points selected in it, so that a move or transform that follows acts on those points alone: a path with selected anchor points keeps them; a path with selected segments drops the segments and keeps its other selected anchor points, and the points at the segments' ends leave the selection unless segmentEnds is true; a path selected whole keeps all its points; a group or compound path selected whole gives way to the paths inside it, each selected whole, leaving out hidden and locked ones, a Shaper Group's original shapes and, while guides are locked, paths made into guides; type, images, symbols, meshes and other objects without anchor points, and ruler guides, leave the selection. With nothing selected, or no anchor point left to keep, it is an error that leaves the selection as it was. Only the selection changes, not the document, so there is nothing to undo → {changed (false when the selection already held only anchor points), count (the paths left selected), points (the anchor points selected on them)}",
has_doc,
edit_points_only
),
]
}
@@ -193,3 +204,104 @@ fn by_link_status(s: &mut Session, p: &Value) -> Result<Value> {
}
Ok(out)
}
/// The anchor points of `path` that `refs` names, leaving out references to points it does not have.
fn on_path(path: &PathData, refs: &BTreeSet<AnchorRef>) -> BTreeSet<AnchorRef> {
refs.iter().copied().filter(|&(si, ai)| path.subpaths.get(si).is_some_and(|sp| ai < sp.anchors.len())).collect()
}
/// The points at the ends of the segments `segments` of `path`.
fn segment_ends(path: &PathData, segments: &BTreeSet<AnchorRef>) -> BTreeSet<AnchorRef> {
let mut ends = BTreeSet::new();
for &(si, seg) in segments {
if let Some(sp) = path.subpaths.get(si) {
ends.extend([(si, seg), (si, (seg + 1) % sp.anchors.len().max(1))]);
}
}
ends
}
/// The paths inside container `n` with at least one anchor point, depth first, through the groups
/// and compound paths in it: hidden and locked objects (and what they hold), a Shaper Group's
/// original shapes, and paths made into guides while `guides_locked`, are left out.
fn paths_inside<'a>(n: &'a Node, guides_locked: bool, out: &mut Vec<&'a Node>) {
let originals = usize::from(n.extras().shaper.is_some());
for c in n.children().into_iter().flatten().skip(originals) {
if !c.visible || c.locked {
continue;
}
match &c.kind {
NodeKind::Path { guide: true, .. } if guides_locked => {}
NodeKind::Path { path, .. } if path.anchors().next().is_some() => out.push(c),
NodeKind::Group { .. } | NodeKind::Compound { .. } => paths_inside(c, guides_locked, out),
_ => {}
}
}
}
/// `addon.select.editPointsOnly`: narrow the selection to the anchor points selected in it.
fn edit_points_only(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "addon.select.editPointsOnly";
let keep_ends = switch_or(p, "segmentEnds", false, C)?;
let guides_locked = s.menu.guides_locked;
let st = s.doc()?;
let (doc, sel) = (&st.doc, &st.selection);
if sel.objects.is_empty() {
return Err(bad(C, "select anchor points or segments first"));
}
// Each path once, in selection order, with its points kept: `None` for all of them.
let mut seen = HashSet::new();
let mut kept: Vec<(NodeId, usize, Option<BTreeSet<AnchorRef>>)> = vec![];
for id in &sel.objects {
let Some(n) = doc.node(*id) else { continue };
match &n.kind {
NodeKind::Path { path, .. } => {
let Some(refs) = sel.anchors.get(id) else {
let count = path.anchors().count();
if count > 0 && seen.insert(*id) {
kept.push((*id, count, None));
}
continue;
};
let mut picked = on_path(path, refs);
if let Some(segments) = sel.segments.get(id)
&& !keep_ends
{
let ends = segment_ends(path, segments);
picked.retain(|r| !ends.contains(r));
}
if !picked.is_empty() && seen.insert(*id) {
kept.push((*id, picked.len(), Some(picked)));
}
}
NodeKind::Group { .. } | NodeKind::Compound { .. } => {
let mut inside = vec![];
paths_inside(n, guides_locked, &mut inside);
for c in inside {
if seen.insert(c.id) {
kept.push((c.id, c.path_data().map_or(0, |path| path.anchors().count()), None));
}
}
}
_ => {}
}
}
let points: usize = kept.iter().map(|(_, n, _)| n).sum();
let objects: Vec<NodeId> = kept.iter().map(|(id, ..)| *id).collect();
let anchors: BTreeMap<NodeId, BTreeSet<AnchorRef>> = kept.into_iter().filter_map(|(id, _, set)| Some((id, set?))).collect();
if objects.is_empty() {
return Err(bad(C, "no anchor points are selected"));
}
let changed = objects != sel.objects || anchors != sel.anchors || !sel.segments.is_empty() || !sel.guides.is_empty();
let count = objects.len();
if changed {
s.select(|_, sel| {
let (key, key_anchor) = (sel.key.filter(|k| objects.contains(k)), sel.key_anchor);
sel.set(objects);
sel.anchors = anchors;
sel.key = key;
sel.key_anchor = key_anchor;
})?;
}
Ok(json!({ "changed": changed, "count": count, "points": points }))
}
@@ -337,3 +337,163 @@ mod by_link_status {
assert!(Session::new().execute(C, &json!({"status": "linked"})).is_err());
}
}
/// Edit Points Only.
mod edit_points_only {
use std::collections::{BTreeMap, BTreeSet};
use serde_json::{Value, json};
use vectorcraft_doc::NodeId;
use super::rect;
use crate::Session;
const C: &str = "addon.select.editPointsOnly";
/// A document with two rectangles, `a` and `b` (four anchors each, anchor 0 first).
fn two() -> (Session, NodeId, NodeId) {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
let a = rect(&mut s, 10.0, 10.0, 50.0, 50.0);
let b = rect(&mut s, 100.0, 10.0, 50.0, 50.0);
(s, a, b)
}
/// Anchors 0 and 1 of `a`, anchor 3 of `b`, and then segment 1 of `b` (its ends are anchors 1 and 2).
fn mixed(s: &mut Session, a: NodeId, b: NodeId) {
let items = json!([{"id": a.0, "anchors": [[0, 0], [0, 1]]}, {"id": b.0, "anchors": [[0, 3]]}]);
s.execute("select.anchorsMany", &json!({"items": items})).unwrap();
s.execute("select.segments", &json!({"id": b.0, "segments": [[0, 1]], "mode": "add"})).unwrap();
}
fn refs(v: &[(usize, usize)]) -> BTreeSet<(usize, usize)> {
v.iter().copied().collect()
}
/// Selected objects, with the selected anchors of those selected in part.
type Picked = (Vec<NodeId>, BTreeMap<NodeId, BTreeSet<(usize, usize)>>);
/// The selected objects and their selected anchors.
fn picked(s: &Session) -> Picked {
let sel = &s.doc().unwrap().selection;
(sel.objects.clone(), sel.anchors.clone())
}
#[test]
fn selected_segments_drop_out_and_the_anchor_points_stay() {
let (mut s, a, b) = two();
mixed(&mut s, a, b);
let before = s.doc().unwrap().selection.clone();
assert_eq!(before.anchors[&b], refs(&[(0, 1), (0, 2), (0, 3)]), "a segment's ends move with it");
let undo = s.doc().unwrap().history.undo.len();
let r = s.execute(C, &json!({})).unwrap();
assert_eq!(r, json!({"changed": true, "count": 2, "points": 3}));
let sel = &s.doc().unwrap().selection;
assert_eq!(sel.objects, vec![a, b]);
assert_eq!(sel.anchors[&a], refs(&[(0, 0), (0, 1)]));
assert_eq!(sel.anchors[&b], refs(&[(0, 3)]), "the segment's ends leave the selection");
assert!(sel.segments.is_empty(), "no segment stays selected");
assert_eq!(s.doc().unwrap().history.undo.len(), undo, "only the selection changes");
}
#[test]
fn segment_ends_stay_as_anchor_points_when_asked() {
let (mut s, a, b) = two();
mixed(&mut s, a, b);
let r = s.execute(C, &json!({"segmentEnds": true})).unwrap();
assert_eq!(r, json!({"changed": true, "count": 2, "points": 5}));
let sel = &s.doc().unwrap().selection;
assert_eq!(sel.anchors[&b], refs(&[(0, 1), (0, 2), (0, 3)]));
assert!(sel.segments.is_empty());
// With the default, a path holding only a selected segment leaves the selection.
s.execute("select.segments", &json!({"id": b.0, "segments": [[0, 0]]})).unwrap();
s.execute("select.anchors", &json!({"id": a.0, "anchors": [[0, 2]], "mode": "add"})).unwrap();
let r = s.execute(C, &json!({"segmentEnds": false})).unwrap();
assert_eq!(r, json!({"changed": true, "count": 1, "points": 1}));
assert_eq!(picked(&s), (vec![a], BTreeMap::from([(a, refs(&[(0, 2)]))])));
}
#[test]
fn a_selection_of_anchor_points_alone_is_left_as_it_is() {
let (mut s, a, b) = two();
s.execute("select.anchors", &json!({"id": a.0, "anchors": [[0, 0], [0, 2]]})).unwrap();
let before = picked(&s);
assert_eq!(s.execute(C, &json!({})).unwrap(), json!({"changed": false, "count": 1, "points": 2}));
assert_eq!(picked(&s), before);
// Paths selected whole keep all their points.
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
assert_eq!(s.execute(C, &json!({})).unwrap(), json!({"changed": false, "count": 2, "points": 8}));
assert_eq!(picked(&s), (vec![a, b], BTreeMap::new()));
}
#[test]
fn groups_and_compound_paths_give_way_to_their_paths_and_other_objects_leave() {
let (mut s, a, b) = two();
let c = rect(&mut s, 200.0, 10.0, 20.0, 20.0);
let hidden = rect(&mut s, 200.0, 100.0, 20.0, 20.0);
let text = NodeId(s.execute("text.create", &json!({"x": 20, "y": 200, "text": "Points"})).unwrap()["id"].as_u64().unwrap());
s.execute("select.set", &json!({"ids": [b.0, c.0, hidden.0, text.0]})).unwrap();
let group = s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [hidden.0]})).unwrap();
s.execute("object.hide", &json!({})).unwrap();
let d = rect(&mut s, 20.0, 20.0, 10.0, 10.0);
s.execute("select.set", &json!({"ids": [a.0, d.0]})).unwrap();
s.execute("object.compoundPath.make", &json!({})).unwrap();
let compound = s.doc().unwrap().selection.objects.clone();
assert_eq!(compound.len(), 1);
let members: Vec<NodeId> = s.doc().unwrap().doc.node(compound[0]).unwrap().children().unwrap().iter().map(|m| m.id).collect();
assert_eq!(members.len(), 2);
s.execute("select.set", &json!({"ids": [compound[0].0, group]})).unwrap();
let r = s.execute(C, &json!({})).unwrap();
assert_eq!(r, json!({"changed": true, "count": 4, "points": 16}), "{r}");
let mut want = members;
want.extend([b, c]);
assert_eq!(picked(&s), (want, BTreeMap::new()), "the hidden path and the type are left out");
}
#[test]
fn guide_paths_in_a_group_are_left_out_while_guides_are_locked() {
let (mut s, a, b) = two();
s.execute("select.set", &json!({"ids": [b.0]})).unwrap();
s.execute("view.guides.make", &json!({})).unwrap();
let text = NodeId(s.execute("text.create", &json!({"x": 20, "y": 200, "text": "Points"})).unwrap()["id"].as_u64().unwrap());
s.execute("select.set", &json!({"ids": [b.0, text.0]})).unwrap();
let group = s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap();
s.execute("view.guides.lock", &json!({"locked": true})).unwrap();
s.execute("select.set", &json!({"ids": [group]})).unwrap();
let before = s.doc().unwrap().selection.clone();
let e = s.execute(C, &json!({})).unwrap_err().to_string();
assert!(e.contains("no anchor points are selected"), "{e}");
assert_eq!(s.doc().unwrap().selection, before);
s.execute("select.set", &json!({"ids": [a.0, group]})).unwrap();
assert_eq!(s.execute(C, &json!({})).unwrap(), json!({"changed": true, "count": 1, "points": 4}));
assert_eq!(picked(&s), (vec![a], BTreeMap::new()));
// Unlocked, the guide path is a path like any other.
s.execute("view.guides.lock", &json!({"locked": false})).unwrap();
s.execute("select.set", &json!({"ids": [group]})).unwrap();
assert_eq!(s.execute(C, &json!({})).unwrap(), json!({"changed": true, "count": 1, "points": 4}));
assert_eq!(picked(&s), (vec![b], BTreeMap::new()));
}
#[test]
fn nothing_to_keep_is_an_error_that_leaves_the_selection() {
let (mut s, a, b) = two();
let text = NodeId(s.execute("text.create", &json!({"x": 20, "y": 200, "text": "Points"})).unwrap()["id"].as_u64().unwrap());
s.execute("select.none", &json!({})).unwrap();
assert!(s.execute(C, &json!({})).is_err(), "nothing selected");
s.execute("select.segments", &json!({"id": a.0, "segments": [[0, 0]]})).unwrap();
s.execute("select.add", &json!({"ids": [text.0]})).unwrap();
let before = s.doc().unwrap().selection.clone();
let e = s.execute(C, &json!({})).unwrap_err().to_string();
assert!(e.contains("no anchor points are selected"), "{e}");
assert_eq!(s.doc().unwrap().selection, before);
for p in [json!({"segmentEnds": "yes"}), json!({"segmentEnds": 1}), json!({"segmentEnds": [true]}), json!({"segmentEnd": true})] {
s.execute("select.anchors", &json!({"id": b.0, "anchors": [[0, 0]]})).unwrap();
s.execute("select.segments", &json!({"id": a.0, "segments": [[0, 0]], "mode": "add"})).unwrap();
let before = s.doc().unwrap().selection.clone();
assert!(s.execute(C, &p).is_err(), "{p}");
assert_eq!(s.doc().unwrap().selection, before, "{p}");
}
assert!(Session::new().execute(C, &Value::Null).is_err(), "without a document");
}
}
@@ -81,6 +81,7 @@ pub(super) const ALLOWED: &[&str] = &[
"addon.pen.segment",
"addon.pen.togglePoint",
"addon.select.byArtboards",
"addon.select.editPointsOnly",
"addon.shapes.box3d",
"addon.shapes.configure",
"addon.shapes.ellipse",
+2
View File
@@ -538,6 +538,8 @@ fn structured_junk() {
("addon.select.byLinkStatus", json!({"status": "embedded", "ids": {"a": 1}, "add": [1], "zoom": "yes"})),
("addon.select.byLinkStatus", json!({"status": ["modified", "embedded"], "ids": [], "add": true, "zoom": true})),
("addon.select.byLinkStatus", json!({"status": [[["linked"]]], "ids": null})),
("addon.select.editPointsOnly", json!({"segmentEnds": "yes"})),
("addon.select.editPointsOnly", json!({"segmentEnds": [true], "ids": [2, u64::MAX]})),
("links.relink", json!({"scope": "each", "paths": [{"ids": [2, u64::MAX, -1, "x"], "path": ""}, null, 7, {"path": [1]}]})),
("links.relink", json!({"scope": ["all"], "path": "/no/such/file.png", "ids": {"a": 1}})),
("links.relink", json!({"scope": "missingInFolder", "path": "", "folder": [], "paths": "x"})),
+1
View File
@@ -108,6 +108,7 @@ pub(crate) fn open_from_menu(app: &mut VectorcraftApp, id: &str) -> Option<Resul
color::legend::COMMAND => color::legend::open,
color::nearest::COMMAND => color::nearest::open,
select::COMMAND => select::open,
select::points_only::COMMAND => select::points_only::open,
_ => return super::arrange::open(app, id),
};
Some(open(app))
+5 -2
View File
@@ -1,8 +1,8 @@
//! Selection Tools in the interface: its submenu (Object › Plug-ins › Selection Tools) and the
//! Select by Artboards dialog (#5548), which lists the artboards with their number, name and size,
//! filters them by name, picks several, fits one in the window on double-click (#5549), and on OK
//! runs `addon.select.byArtboards` with the relation chosen; and Select by Link Status
//! ([`link_status`], #5526).
//! runs `addon.select.byArtboards` with the relation chosen; Select by Link Status
//! ([`link_status`], #5526); and Edit Points Only ([`points_only`]).
use craft::behavior::{Selection, keyed};
use craft::i18n::Folder;
@@ -27,6 +27,7 @@ use crate::VectorcraftApp;
use crate::menus::{Sep, cp};
pub mod link_status;
pub mod points_only;
/// Select by Artboards, and its dialog's kind.
pub const COMMAND: &str = "addon.select.byArtboards";
@@ -40,6 +41,8 @@ const LIST_ROWS: u16 = 9;
pub fn menu() -> Vec<Node> {
let mut v = vec![cp("Select by Artboards…", COMMAND, Value::Null), Sep];
v.extend(link_status::menu());
v.push(Sep);
v.extend(points_only::menu());
v
}
@@ -0,0 +1,51 @@
//! Edit Points Only in the interface: its item in Object › Plug-ins › Selection Tools and its
//! dialog, which previews the narrowed selection on the canvas and runs
//! `addon.select.editPointsOnly` on OK; Cancel puts the selection back.
use std::borrow::Cow;
use craft::menu::Node;
use craft::ui::contract::Bind;
use craft::ui::patterns::form_dialogs::{DialogFields, Param, ParamDialog, ParamKind};
use serde_json::{Map, Value, json};
use crate::VectorcraftApp;
use crate::addons::dialogs::Spec;
use crate::dialogs::form;
use crate::menus::c;
/// Edit Points Only: the dialog's key and the command its OK runs.
pub const COMMAND: &str = "addon.select.editPointsOnly";
static SPEC: Spec = Spec { command: COMMAND, params, found: None };
/// The menu item.
pub fn menu() -> Vec<Node> {
vec![c("Edit Points Only…", COMMAND)]
}
/// The dialog's rows.
fn rows() -> Vec<Param> {
vec![Param::new("segmentEnds", tl!("Keep Ends of Selected Segments"), ParamKind::bool(false))]
}
/// The command's params for the dialog's `fields`.
fn params(fields: &DialogFields) -> Value {
Value::Object(form::json_of(&rows(), fields))
}
/// Opens the dialog on the active document, with the ends of selected segments left out.
pub(crate) fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
if app.session.active().is_none() {
return Err("no document".into());
}
let mut opening = Map::new();
opening.insert("segmentEnds".into(), json!(false));
let fields = form::fields_of(&rows(), &opening);
crate::addons::dialogs::open(app, &SPEC, fields, |fields| {
ParamDialog::new(COMMAND, tl!("Edit Points Only"), Cow::Owned(rows())).previews(true).values(Bind::bound(fields))
})
}
#[cfg(test)]
mod tests;
@@ -0,0 +1,85 @@
use std::collections::BTreeSet;
use serde_json::json;
use vectorcraft_doc::NodeId;
use vectorcraft_engine::Session;
use crate::VectorcraftApp;
use crate::addons::dialogs::tests as host;
use crate::tests::panel_harness::Panel as Harness;
/// An app with a window and two rectangles: anchors 0 and 1 of the first selected, and segment 1
/// of the second (whose ends are its anchors 1 and 2) beside its anchor 3.
fn app() -> (VectorcraftApp, NodeId, NodeId) {
let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default()));
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
let mut rect = |x| NodeId(app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap());
let (a, b) = (rect(10), rect(100));
let items = json!([{"id": a.0, "anchors": [[0, 0], [0, 1]]}, {"id": b.0, "anchors": [[0, 3]]}]);
app.run("select.anchorsMany", json!({"items": items})).unwrap();
app.run("select.segments", json!({"id": b.0, "segments": [[0, 1]], "mode": "add"})).unwrap();
(app, a, b)
}
fn refs(v: &[(usize, usize)]) -> BTreeSet<(usize, usize)> {
v.iter().copied().collect()
}
/// The selected anchors of `id`, and whether any segment is selected.
fn points(app: &VectorcraftApp, id: NodeId) -> (Option<BTreeSet<(usize, usize)>>, bool) {
let sel = &app.session.doc().unwrap().selection;
(sel.anchors.get(&id).cloned(), !sel.segments.is_empty())
}
#[test]
fn the_dialog_previews_keeps_on_ok_and_takes_the_segment_ends_from_the_keyboard() {
let (app, a, b) = app();
let undo = app.session.doc().unwrap().history.undo.len();
let mut panel = Harness::new(app, crate::tests::picks::dialogs);
host::open_item(&mut panel.app(), "Selection Tools", "Edit Points Only…");
panel.frame();
let id = host::dialog_id(&panel.app());
assert_eq!(host::read(&panel.app(), id, |f| f.bool("segmentEnds")), Some(false));
assert_eq!(points(&panel.app(), b), (Some(refs(&[(0, 3)])), false), "the preview drops the segment and its ends");
assert_eq!(points(&panel.app(), a).0, Some(refs(&[(0, 0), (0, 1)])));
panel.focus("Keep Ends of Selected Segments");
panel.key(egui::Key::Space, egui::Modifiers::NONE);
panel.frame();
assert_eq!(host::read(&panel.app(), id, |f| f.bool("segmentEnds")), Some(true));
assert_eq!(points(&panel.app(), b), (Some(refs(&[(0, 1), (0, 2), (0, 3)])), false), "the ends are kept as anchor points");
panel.click("OK");
panel.frame();
let app = panel.app();
assert!(!app.any_dialog_open());
assert_eq!(points(&app, b), (Some(refs(&[(0, 1), (0, 2), (0, 3)])), false));
assert_eq!(app.session.doc().unwrap().history.undo.len(), undo, "a selection change is not an undo step");
}
#[test]
fn cancel_puts_the_selection_back() {
let (app, _, b) = app();
let before = app.session.doc().unwrap().selection.clone();
let mut panel = Harness::new(app, crate::tests::picks::dialogs);
host::open_item(&mut panel.app(), "Selection Tools", "Edit Points Only…");
panel.frame();
assert_eq!(points(&panel.app(), b), (Some(refs(&[(0, 3)])), false));
panel.click("Cancel");
panel.frame();
let app = panel.app();
assert!(!app.any_dialog_open());
assert_eq!(app.session.doc().unwrap().selection, before);
}
#[test]
fn ok_with_nothing_to_keep_says_why_and_leaves_the_selection() {
let (mut app, a, _) = app();
app.run("select.segments", json!({"id": a.0, "segments": [[0, 0]]})).unwrap();
let before = app.session.doc().unwrap().selection.clone();
host::open_item(&mut app, "Selection Tools", "Edit Points Only…");
let id = host::dialog_id(&app);
assert!(host::confirm(&app, id));
host::frame(&mut app);
assert!(!app.any_dialog_open());
assert_eq!(app.session.doc().unwrap().selection, before);
assert!(app.ui.status.contains("no anchor points are selected"), "{}", app.ui.status);
}
+21
View File
@@ -17313,6 +17313,27 @@ locked". Select by Link Status… lists every image and placed document with its
name and filters by status (Show), chooses rows with checkboxes (All / None act on the rows shown), and on Select
selects the rows chosen, zooming to them when Zoom to Selection is on (the default).
`addon.select.editPointsOnly {segmentEnds?}` (Edit Points Only…) narrows the selection to the anchor points selected in
it, so that a move or transform that follows acts on those points alone. A path with selected anchor points keeps them.
A path with selected segments drops the segments and keeps its other selected anchor points; the points at the ends of
the segments leave the selection unless `segmentEnds` is `true` (default `false`), which keeps them as selected anchor
points. A path selected whole keeps all its points. A group or compound path selected whole is replaced by the paths
inside it, each selected whole, without hidden and locked ones, without a Shaper Group's original shapes and, while
guides are locked, without paths made into guides. Type,
images, symbols, meshes and other objects without anchor points, and ruler guides, leave the selection. Only the
selection changes, so there is nothing to undo. It returns `{changed, count, points}`: `changed` is `false` when the
selection already held only anchor points, `count` is the number of paths left selected and `points` the number of
anchor points selected on them. Nothing selected, no anchor point left to keep ("no anchor points are selected"), or a
`segmentEnds` that is not `true` or `false` is an error, and the selection is left as it was.
```json
{"name":"run_command","arguments":{"command":"addon.select.editPointsOnly","params":{"segmentEnds":false}}}
```
In the desktop app, Object › Plug-ins › Selection Tools › Edit Points Only… opens a dialog with Keep Ends of Selected
Segments (off). With Preview on, the canvas shows the narrowed selection; OK keeps it and Cancel puts the selection
back.
### Vector Halftone (live)
`addon.color.halftone` (Effect › Color Effects › Vector Halftone…, also in Object › Plug-ins › Color Effects) draws its
+1
View File
@@ -1529,6 +1529,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
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. Its tool is also in the Lasso tool's group in both shipped toolbars, after the Enclosing Lasso, and All Tools lists it there, under Select; a toolbar edited before it joined keeps its saved layout until Reset Toolbar (tests `polygonal_lasso_is_in_the_lasso_flyout`, `a_saved_toolbar_without_polygonal_lasso_keeps_its_layout` and `a_torn_off_lasso_group_shows_polygonal_lasso` in `edit_toolbar::tests`, `polygonal_lasso_is_in_the_lasso_group_once` in `addons::tests`, `headless_lists_the_lasso_group` in `vectorcraft-mcp`). It has no default shortcut. 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`.
Edit Points Only (Object › Plug-ins › Selection Tools, a VectorCraft addition) narrows a Direct Selection to its selected anchor points (`addon.select.editPointsOnly {segmentEnds?}`): selected segments leave the selection, and the points at their ends leave it too unless Keep Ends of Selected Segments is on; paths selected whole keep every point; a group or compound path selected whole gives way to the visible, unlocked paths inside it; type, images, symbols and other objects without anchor points leave the selection. Only the selection changes, so there is no undo step; with nothing left to keep it is an error and the selection stays as it was. The dialog previews the narrowed selection, and Cancel puts the selection back. Tests: `crates/engine/src/cmd/addons/select/tests.rs` (`edit_points_only`), `crates/ui-egui/src/addons/select/points_only/tests.rs`, `crates/engine/tests/command_sweep.rs`.
The Links panel provides an item right-click context menu on link rows offering Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Separator, and Embed Image / Unembed…. Right-clicking an unselected row selects that row first; right-clicking a row that is already part of a multi-selection preserves the multi-selection. Tests: `panels::tests_links::right_click_context_menu_in_links_panel`.
The Location row of the Links panel's Link Info has a folder button, Show in Folder, that opens the folder of the file Link Info shows in the system's file manager (`links.reveal {id}` with that image's id); the help page describes a folder icon on this row ([Links information](https://helpx.adobe.com/illustrator/using/links-info.html)). The button's name and its off state while the file is missing or no file manager is available (the web build) are VectorCraft's own. Tests: `panels::tests_links::link_infos_location_row_shows_the_file_in_its_folder`.
A marquee selects a clip group, or an object on a layer with a clipping mask, only when it reaches the area inside the clipping path, and it measures the art only within that path's bounds. Within the bounds of a mask that is not a rectangle, it can still select art that the mask hides. Direct Selection's marquee still selects the hidden anchor points inside it (#2345).