fix: a projected edge stays the edge that was picked when its body changes (#730)

A sketch's link to a projected edge now keeps the edge's persistent name and finds it by that name when the body changes, instead of taking whichever edge ends up nearest its point.
This commit is contained in:
NOWN-DEV authored and GitHub committed 2026-10-13 12:06:13 -04:00
1 parent 4a989f6e2d
commit 58af8accfa
12 files changed
+365 -30

No files matched your search

@@ -150,7 +150,10 @@ fn wire_frame_include_other_component_refresh_break_lost_and_reopen() {
assert_eq!(s.doc.to_json(), before);
// Lost references retain the last coordinates and explicit marker, with no guessing.
let sk = s.doc_mut().sketch_mut(sketch).unwrap();
sk.links.iter_mut().find(|l| l.id == link).unwrap().source = solidcraft_sketch::LinkSource::Edge { body: "Missing".into(), at: Vec3::ZERO };
let entry = sk.links.iter_mut().find(|l| l.id == link).unwrap();
entry.source = solidcraft_sketch::LinkSource::Edge { body: "Missing".into(), at: Vec3::ZERO };
// The link is the edge it names; without the name it is the edge nearest its point.
entry.edge_name = None;
run(&mut s, "sketch.line", json!({"points":[[2,0],[3,0]]}));
let sk = s.doc.sketch(sketch).unwrap();
assert!(sk.link(&link).unwrap().lost);