mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 19:57:05 -06:00
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:
committed by
bflatastic
co-authored by
Claude Opus 5.5
parent
8362223932
commit
aa15cb52bd
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user