Direct Selection: Shift-click deselects one anchor of a path selected whole

select.anchors in toggle and add mode now starts from all of a path's
anchors when the path is selected as a whole, as select.anchorsMany does.
Before, Shift-clicking an anchor of a fully selected path left only that
anchor selected.

Follow-up to #1237 / #1254.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fabio Lussi
2026-10-12 07:25:32 +07:00
committed by bflatastic
co-authored by Claude Opus 5.5
parent 8362223932
commit aa15cb52bd
2 changed files with 45 additions and 1 deletions
+6 -1
View File
@@ -340,12 +340,17 @@ fn anchors(s: &mut Session, p: &Value) -> Result<Value> {
Some("toggle") => "toggle",
Some(m) => return Err(bad(C, format!("unknown mode {m:?}"))),
};
s.select(|_, sel| {
s.select(|d, sel| {
if mode == "set" {
sel.clear();
}
// A path selected as a whole has every anchor selected: toggle and add start from them all.
let whole = sel.contains(id) && sel.partial(id).is_none();
sel.add(id);
let e = sel.anchors.entry(id).or_default();
if whole && let Some(path) = d.node(id).and_then(|n| n.path_data()) {
e.extend(path.anchors().map(|(s, i, _)| (s, i)));
}
for r in refs {
if mode == "toggle" && e.contains(&r) {
e.remove(&r);