Merge pull request #10116 from dotCooCoo/feat/edit-points-only

Selection Tools: Edit Points Only narrows a Direct Selection to its anchor points
This commit is contained in:
.CooCoo authored and GitHub committed 2026-11-30 14:19:49 -08:00
commit 38846fcdf3
14 files changed
+785 -11

No files matched your search

+127 -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; any non-boolean value, including null, is an error)} narrow the selection to paths and their selected anchor points: 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 stays selected whole and still receives object transforms, including stroke and effect scaling when enabled; a group or compound path selected whole gives way to the paths inside it, each selected whole unless it has an explicit anchor pick, leaving out hidden and locked ones, a Shaper Group's original shapes and, while guides are locked, paths made into guides; explicit anchor picks take precedence regardless of selection order; 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. The command does not add an undo step. In the desktop dialog, a successful preview or OK clears only that dialog's preview error if it is still the current status message → {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,114 @@ 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 = match p.get("segmentEnds") {
None => false,
Some(value) => value.as_bool().ok_or_else(|| bad(C, "`segmentEnds` must be true or false"))?,
};
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 explicit: HashSet<NodeId> = sel.objects.iter().copied().filter(|id| sel.anchors.contains_key(id)).collect();
let mut kept: Vec<(NodeId, usize, Option<BTreeSet<AnchorRef>>)> = vec![];
for id in &sel.objects {
let Some(n) = doc.node(*id) else { continue };
if !doc.ancestry(*id).is_some_and(|ancestors| ancestors.iter().all(|id| doc.node(*id).is_some_and(|n| n.visible && !n.locked))) {
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 explicit.contains(&c.id) {
continue;
}
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,320 @@ 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 explicit_anchor_picks_override_group_expansion_in_either_order() {
for group_first in [true, false] {
let (mut s, a, b) = two();
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
let group = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap());
s.select(|_, sel| {
sel.set(if group_first { vec![group, a] } else { vec![a, group] });
sel.anchors.insert(a, refs(&[(0, 0)]));
})
.unwrap();
let before = s.doc().unwrap().doc.node(a).unwrap().path_data().unwrap().clone();
assert_eq!(s.execute(C, &json!({})).unwrap(), json!({"changed": true, "count": 2, "points": 5}));
assert_eq!(s.doc().unwrap().selection.anchors[&a], refs(&[(0, 0)]));
s.execute("object.move", &json!({"dx": 10, "dy": 20})).unwrap();
let after = s.doc().unwrap().doc.node(a).unwrap().path_data().unwrap();
for ((_, i, old), (_, _, new)) in before.anchors().zip(after.anchors()) {
if i == 0 {
assert_ne!(new.p, old.p);
} else {
assert_eq!(new.p, old.p, "unselected anchors stay in place");
}
}
}
}
#[test]
fn hidden_or_locked_selected_nodes_and_their_ancestors_are_left_out() {
for locked in [false, true] {
for target in ["path", "group", "ancestor", "layer"] {
let (mut s, a, b) = two();
let good = rect(&mut s, 200.0, 10.0, 20.0, 20.0);
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
let group = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap());
let blocked = match target {
"path" => a,
"layer" => s.doc().unwrap().doc.layers[0].id,
_ => group,
};
let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
let node = doc.node_mut(blocked).unwrap();
if locked {
node.locked = true;
} else {
node.visible = false;
}
let selected = if matches!(target, "path" | "ancestor") { a } else { group };
s.execute("select.set", &json!({"ids": [good.0, selected.0]})).unwrap();
if target == "layer" {
let before = s.doc().unwrap().selection.clone();
assert!(s.execute(C, &json!({})).is_err());
assert_eq!(s.doc().unwrap().selection, before);
} else {
s.execute(C, &json!({})).unwrap();
assert_eq!(picked(&s), (vec![good], BTreeMap::new()), "{target}, locked: {locked}");
}
}
}
}
#[test]
fn group_expansion_selects_each_descendant_path() {
let (mut s, _, _) = two();
let mut groups = vec![];
let mut paths = vec![];
for x in [10.0, 100.0, 200.0] {
let a = rect(&mut s, x, 100.0, 20.0, 20.0);
let b = rect(&mut s, x, 150.0, 20.0, 20.0);
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
groups.push(NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()));
paths.extend([a, b]);
}
s.select(|_, sel| sel.set(groups)).unwrap();
s.execute(C, &json!({})).unwrap();
assert_eq!(picked(&s), (paths, BTreeMap::new()));
}
#[test]
fn appearance_row_commands_survive_preview_replacement_and_cancel() {
for index in [json!(1), Value::Null] {
for selection_preview in [false, true] {
let (mut s, a, b) = two();
mixed(&mut s, a, b);
s.execute("appearance.addFill", &json!({})).unwrap();
s.execute("appearance.setActiveItem", &json!({"index": 0})).unwrap();
s.begin_interaction("Drag").unwrap();
s.doc_mut().unwrap().interaction.as_mut().unwrap().tool = !selection_preview;
if selection_preview {
s.preview(C, &json!({})).unwrap();
assert_eq!(s.appearance_item(), None);
} else {
s.preview("object.move", &json!({"dx": 10, "dy": 0})).unwrap();
}
s.execute("appearance.setActiveItem", &json!({"index": index})).unwrap();
let expected = index.as_u64().map(|i| i as usize);
s.preview("object.move", &json!({"dx": 20, "dy": 0})).unwrap();
assert_eq!(s.appearance_item(), expected, "replacement preserves the explicit row command");
s.cancel_interaction().unwrap();
assert_eq!(s.appearance_item(), expected, "cancel preserves the explicit row command");
}
}
}
#[test]
fn cancel_preserves_an_appearance_row_command_without_another_preview() {
for index in [json!(1), Value::Null] {
let (mut s, a, b) = two();
mixed(&mut s, a, b);
s.execute("appearance.addFill", &json!({})).unwrap();
s.execute("appearance.setActiveItem", &json!({"index": 0})).unwrap();
s.begin_interaction("Drag").unwrap();
s.doc_mut().unwrap().interaction.as_mut().unwrap().tool = true;
s.preview(C, &json!({})).unwrap();
s.execute("appearance.setActiveItem", &json!({"index": index})).unwrap();
s.cancel_interaction().unwrap();
assert_eq!(s.appearance_item(), index.as_u64().map(|i| i as usize));
}
}
#[test]
fn canceling_a_selection_preview_restores_the_active_appearance_item() {
let (mut s, a, b) = two();
mixed(&mut s, a, b);
s.execute("appearance.addFill", &json!({})).unwrap();
s.execute("appearance.setActiveItem", &json!({"index": 0})).unwrap();
let before = s.doc().unwrap().doc.node(a).unwrap().appearance.items.clone();
s.begin_interaction("Edit Points Only").unwrap();
s.preview(C, &json!({})).unwrap();
assert_eq!(s.appearance_item(), None);
s.preview(C, &json!({"segmentEnds": true})).unwrap();
assert_eq!(s.appearance_item(), None);
s.cancel_interaction().unwrap();
assert_eq!(s.appearance_item(), Some(0));
s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap();
let after = &s.doc().unwrap().doc.node(a).unwrap().appearance.items;
assert_ne!(after[0], before[0]);
assert_eq!(&after[1..], &before[1..]);
}
#[test]
fn whole_paths_keep_object_transforms_and_stroke_scaling() {
let (mut s, a, _) = two();
s.execute("select.set", &json!({"ids": [a.0]})).unwrap();
s.execute("stroke.set", &json!({"weight": 4})).unwrap();
let before = s.doc().unwrap().doc.node(a).unwrap().appearance.stroke_width();
s.execute(C, &json!({})).unwrap();
assert!(!s.doc().unwrap().selection.anchors.contains_key(&a));
s.execute("object.transform", &json!({"matrix": [2, 0, 0, 2, 0, 0], "strokes": true})).unwrap();
assert!(s.doc().unwrap().doc.node(a).unwrap().appearance.stroke_width() > before);
}
#[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": null}),
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");
}
}
+15 -2
View File
@@ -139,7 +139,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Select Appearance Item",
[],
None,
"{index: paint-order item index in the first selected object's stack | null} make that fill/stroke row the target of the paint.setFill/setStroke, stroke.set/setAdvanced, paint.editGradient/setGradientGeom, transparency.set and effect.* calls that omit `item` (a fill row brings the Fill proxy forward, a stroke row the Stroke proxy); null or any selection change clears it → {index}",
"{index: paint-order item index in the first selected object's stack | null} make that fill/stroke row the target of the paint.setFill/setStroke, stroke.set/setAdvanced, paint.editGradient/setGradientGeom, transparency.set and effect.* calls that omit `item` (a fill row brings the Fill proxy forward, a stroke row the Stroke proxy); null or any selection change clears it. A row set or cleared outside a drag's preview stays set or cleared when the preview is replaced or canceled → {index}",
has_selection,
set_active_item
),
@@ -174,7 +174,7 @@ pub fn specs() -> Vec<CommandSpec> {
}
/// The Appearance panel's active row, remembered for the selection it was chosen in.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct ActiveItem {
doc: u64,
objects: Vec<NodeId>,
@@ -956,6 +956,7 @@ fn set_active_item(s: &mut Session, p: &Value) -> Result<Value> {
let index = match p.get("index") {
Some(Value::Null) => {
s.active_appearance_item = None;
clear_preview_item(s);
return Ok(json!({ "index": Value::Null }));
}
Some(_) => index_param(p, "index", C)?,
@@ -968,9 +969,21 @@ fn set_active_item(s: &mut Session, p: &Value) -> Result<Value> {
let doc = st.uid;
s.fill_active = fill;
s.active_appearance_item = Some(ActiveItem { doc, objects, index });
clear_preview_item(s);
Ok(json!({ "index": index }))
}
fn clear_preview_item(s: &mut Session) {
if !s.previewing {
if let Some(it) = s.active_mut().and_then(|st| st.interaction.as_mut()) {
it.active_appearance_item = None;
}
if let Some(held) = &mut s.held_interaction {
held.interaction.active_appearance_item = None;
}
}
}
fn add_item(s: &mut Session, p: &Value, fill: bool) -> Result<Value> {
let cmd = if fill { "appearance.addFill" } else { "appearance.addStroke" };
let mut ids = row_targets(s, p, cmd)?;
@@ -83,6 +83,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",
+7
View File
@@ -10,6 +10,7 @@ pub struct Interaction {
pub doc: Arc<Document>,
/// The selection the previews start from (shared, so a preview frame copies nothing).
pub selection: Arc<Selection>,
pub(crate) active_appearance_item: Option<PreviewAppearanceItem>,
/// The document's [`crate::DocState::revision`] when the interaction began. The previews change the document's
/// revision, and this value stays the same until the interaction ends.
pub revision: u64,
@@ -62,6 +63,12 @@ impl Interaction {
}
}
#[derive(Clone, Debug)]
pub(crate) struct PreviewAppearanceItem {
pub(crate) before: Option<crate::cmd::appearance::ActiveItem>,
pub(crate) after: Option<crate::cmd::appearance::ActiveItem>,
}
/// An interaction that a command from outside the tool set aside while it runs
/// ([`crate::Session::outside_interaction`]).
#[derive(Debug)]
+16
View File
@@ -545,6 +545,7 @@ impl Session {
effect: None,
doc: st.doc.clone(),
selection: Arc::new(st.selection.clone()),
active_appearance_item: None,
revision: st.revision,
preview: None,
tool: false,
@@ -573,6 +574,8 @@ impl Session {
if self.script_running() {
return Err(EngineError::Busy);
}
self.restore_preview_appearance_item();
let before_item = self.active_appearance_item.clone();
// While the active tool paints with the chosen fill or stroke (the Live Paint Bucket, the
// Shape Builder), paint previews of that kind change only the colors it paints with, so each
// preview starts from the colors the interaction began with; so does a preview with
@@ -639,8 +642,11 @@ impl Session {
}
let params = self.noted(params);
let batch_paint = (r.is_ok() && cmd == "command.batch").then(|| self.paint.clone());
let after_item = self.active_appearance_item.clone();
let st = self.doc_mut()?;
if let Some(it) = &mut st.interaction {
it.active_appearance_item =
(before_item != after_item).then_some(crate::interaction::PreviewAppearanceItem { before: before_item, after: after_item });
it.used_defaults_only |= ran_defaults_only;
// A failed preview leaves the document at the snapshot, so nothing is left to commit
// (not even an earlier successful preview, which the reset above already undid).
@@ -758,8 +764,18 @@ impl Session {
}
}
fn restore_preview_appearance_item(&mut self) {
let changed = self.active_mut().and_then(|st| st.interaction.as_mut()).and_then(|it| it.active_appearance_item.take());
if let Some(changed) = changed
&& self.active_appearance_item == changed.after
{
self.active_appearance_item = changed.before;
}
}
pub fn cancel_interaction(&mut self) -> Result<()> {
self.put_back_interaction();
self.restore_preview_appearance_item();
self.clear_deferred_overlay_cache();
self.decoded_images.empty();
self.pending_paint = None;
+2
View File
@@ -562,6 +562,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"})),
+35 -2
View File
@@ -34,6 +34,7 @@ pub(crate) struct Spec {
pub(crate) struct AddonDialogs {
open: Option<Open>,
preview: LivePreview,
preview_error: Option<(u64, String)>,
/// The open Tangent Circle Tool radius dialog.
pub(crate) tangent_radius: Option<super::pathtools::tangent_circle_radius::Open>,
}
@@ -65,6 +66,7 @@ fn active_document(app: &VectorcraftApp) -> Option<(u64, u64)> {
/// Closes the open add-on dialog without an answer and rolls its preview back.
fn close_open(app: &mut VectorcraftApp) {
let Some(open) = app.addon_dialogs.open.take() else { return };
app.addon_dialogs.preview_error = None;
let id = open.id;
if let (Some(host), Some(ctx)) = (app.dialogs(), app.ui_ctx.clone()) {
host.with(|h| {
@@ -108,6 +110,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))
@@ -132,6 +135,7 @@ fn pump_commit(app: &mut VectorcraftApp) {
if !on_document {
// Switching drawings already ends the old preview. Discard its bookkeeping without touching the other drawing.
app.addon_dialogs.preview = LivePreview::default();
app.addon_dialogs.preview_error = None;
}
let live = host.with(|h| h.get_mut_by_id::<HostedParamDialog>(id).map(|d| (d.is_previewing(), (spec.params)(d.fields()))));
if on_document && let Some((previewing, params)) = &live {
@@ -139,6 +143,13 @@ fn pump_commit(app: &mut VectorcraftApp) {
let label = vectorcraft_engine::find_command(spec.command).map_or(spec.command, |command| command.label);
let answer = preview.run(app, *previewing, label, spec.command, params);
app.addon_dialogs.preview = preview;
if spec.command == super::select::points_only::COMMAND {
match &answer {
Some(Err(_)) => app.addon_dialogs.preview_error = Some((app.ui.status_sets, app.ui.status.clone())),
Some(Ok(_)) => clear_preview_error(app),
None => {}
}
}
if let (Some(found), Some(answer)) = (spec.found, answer) {
host.with(|h| {
if let Some(d) = h.get_mut_by_id::<HostedParamDialog>(id) {
@@ -156,18 +167,40 @@ fn pump_commit(app: &mut VectorcraftApp) {
app.status("The document was reverted. Reopen this dialog to continue.");
} else if !on_document {
app.status("The add-on settings apply only to the drawing where the dialog opened.");
} else if let Err(error) = preview.commit(app, spec.command, (spec.params)(&result.fields)) {
app.status(error);
} else {
let params = (spec.params)(&result.fields);
let answer = if spec.command == super::select::points_only::COMMAND {
preview.commit_selection(app, spec.command, params)
} else {
preview.commit(app, spec.command, params)
};
if let Err(error) = answer {
app.status(error);
} else if spec.command == super::select::points_only::COMMAND {
clear_preview_error(app);
}
}
app.addon_dialogs.preview_error = None;
}
Some(None) => {
app.addon_dialogs.open = None;
app.addon_dialogs.preview_error = None;
mem::take(&mut app.addon_dialogs.preview).cancel(app);
}
None if live.is_none() => {
app.addon_dialogs.open = None;
app.addon_dialogs.preview_error = None;
mem::take(&mut app.addon_dialogs.preview).cancel(app);
}
None => {}
}
}
fn clear_preview_error(app: &mut VectorcraftApp) {
if let Some((sets, error)) = app.addon_dialogs.preview_error.take()
&& app.ui.status_sets == sets
&& app.ui.status == error
{
app.ui.status.clear();
}
}
+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,175 @@
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 ok_drops_puppet_pins_without_an_undo_step() {
for previewing in [true, false] {
let (mut app, a, b) = app();
app.run("select.set", json!({"ids": [a.0, b.0]})).unwrap();
app.run("object.group", json!({})).unwrap();
app.run("object.puppetWarp", json!({"pins": [[35, 35]], "moved": [[35, 35]], "rest": true})).unwrap();
assert!(app.session.doc().unwrap().doc.puppet.is_some());
let undo = app.session.doc().unwrap().history.undo.len();
host::open_item(&mut app, "Selection Tools", "Edit Points Only…");
let id = host::dialog_id(&app);
if previewing {
host::frame(&mut app);
assert!(app.session.doc().unwrap().doc.puppet.is_none());
}
assert!(host::confirm(&app, id));
host::frame(&mut app);
assert!(!app.any_dialog_open());
let st = app.session.doc().unwrap();
assert!(st.doc.puppet.is_none());
assert_eq!(st.selection.objects, vec![a, b]);
assert!(!app.session.in_interaction());
assert_eq!(st.history.undo.len(), undo, "pin cleanup does not add 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 successful_preview_and_confirmation_preserve_another_status() {
for previewing in [true, false] {
let (mut app, _, _) = app();
host::open_item(&mut app, "Selection Tools", "Edit Points Only…");
let id = host::dialog_id(&app);
app.status("The active text edit reported a warning.");
if previewing {
host::frame(&mut app);
assert_eq!(app.ui.status, "The active text edit reported a warning.");
}
assert!(host::confirm(&app, id));
host::frame(&mut app);
assert_eq!(app.ui.status, "The active text edit reported a warning.");
assert!(!app.any_dialog_open());
}
}
#[test]
fn recovering_from_a_preview_error_preserves_a_later_status() {
for previewing in [true, false] {
for same_text in [true, false] {
let (mut app, a, _) = app();
app.run("select.segments", json!({"id": a.0, "segments": [[0, 0]]})).unwrap();
host::open_item(&mut app, "Selection Tools", "Edit Points Only…");
let id = host::dialog_id(&app);
host::frame(&mut app);
assert!(app.ui.status.contains("no anchor points are selected"));
let status = if same_text { app.ui.status.clone() } else { "Another command reported a warning.".to_owned() };
app.status(status.clone());
host::set(&app, id, "segmentEnds", json!(true));
if previewing {
host::frame(&mut app);
assert_eq!(app.ui.status, status);
}
assert!(host::confirm(&app, id));
host::frame(&mut app);
assert_eq!(app.ui.status, status);
}
}
}
#[test]
fn keeping_segment_ends_clears_the_preview_error() {
for previewing in [true, false] {
let (mut app, a, _) = app();
app.run("select.segments", json!({"id": a.0, "segments": [[0, 0]]})).unwrap();
host::open_item(&mut app, "Selection Tools", "Edit Points Only…");
let id = host::dialog_id(&app);
host::frame(&mut app);
assert!(app.ui.status.contains("no anchor points are selected"), "{}", app.ui.status);
host::set(&app, id, "segmentEnds", json!(true));
if previewing {
host::frame(&mut app);
assert!(app.ui.status.is_empty(), "{}", app.ui.status);
assert_eq!(points(&app, a), (Some(refs(&[(0, 0), (0, 1)])), false));
}
assert!(host::confirm(&app, id));
host::frame(&mut app);
assert!(app.ui.status.is_empty(), "{}", app.ui.status);
assert!(!app.any_dialog_open());
}
}
#[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);
}
+6
View File
@@ -125,6 +125,12 @@ impl LivePreview {
Ok(Value::Null)
}
/// OK for a selection command: rolls its preview back and runs the command without an interaction.
pub(crate) fn commit_selection(self, app: &mut VectorcraftApp, cmd: &str, params: Value) -> Result<Value, String> {
self.cancel(app);
Self::default().commit(app, cmd, params)
}
/// Cancel: rolls a shown preview back, and leaves any other edit in progress as it is.
pub(crate) fn cancel(self, app: &mut VectorcraftApp) {
if self.previewed.is_some() && self.owns(app) {
+27
View File
@@ -986,6 +986,8 @@ Cmd+Alt+/ runs `appearance.addStroke` (`press_key {key: "/", mods: {cmd: true, a
`item` to edit one of them; `run_command appearance.setActiveItem {"index": n}` makes that row the target of later
calls that omit `item` (as clicking the row in the Appearance panel does) until the selection changes; the proxy of
its kind (`paint.proxies`) and the Gradient tool's annotator then show that row.
An `appearance.setActiveItem` call made outside a drag's preview keeps its selected row, including an explicit
`index: null`, when the preview is replaced or canceled.
`inspect_document` reports it as `paint.appearanceItem`. `paint.setFill` and `paint.setStroke` also take `opacity`
(0 to 100, a percentage as in `transparency.set`), which sets the opacity of the fill or stroke row they paint, with
or without a new paint, as one undo step. An opacity that no target takes is an error and also leaves the paint
@@ -17474,6 +17476,31 @@ 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 paths and their selected
anchor points. 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 stays selected whole and still receives object transforms, including stroke and effect
scaling when enabled. A group or compound path selected whole is replaced by the paths
inside it, each selected whole unless it has an explicit anchor pick. Explicit anchor picks take precedence regardless
of selection order. The command leaves out hidden and locked paths, 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. The command
does not add an undo step. 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` (including `null`) 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.
After a failed preview, a successful preview or OK clears the dialog's error only if that error is still the current
status message. Messages from other commands stay displayed.
### Vector Halftone (live)
`addon.color.halftone` (Effect › Color Effects › Vector Halftone…, also in Object › Plug-ins › Color Effects) draws its
+1
View File
@@ -1535,6 +1535,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, leaving out a Shaper Group's original shapes and, while guides are locked, paths made into guides; 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).