Add persisted per-view port anchors and connection-aware border placement

This commit is contained in:
2026-09-06 01:20:28 +03:00
parent 93fd32c684
commit 35133de650
13 changed files with 1435 additions and 149 deletions
+34
View File
@@ -732,6 +732,40 @@ pub fn validate(p: &Project) -> Vec<Issue> {
}
let mut elements = BTreeSet::new();
for (key, n) in &d.nodes {
let mut ports = BTreeSet::new();
for anchor in &n.port_anchors {
if !ports.insert(anchor.port) {
error(
&mut out,
n.id,
"duplicate_port_anchor",
"port_anchors",
"Each port has at most one manual anchor per owner placement.",
);
}
if !p
.elements
.get(&anchor.port)
.is_some_and(|e| e.kind() == Kind::Port && e.parent == Some(n.element))
{
error(
&mut out,
n.id,
"port_anchor_owner",
"port_anchors",
"A manual anchor must reference a direct child port of its owner placement; repair anchors in the same transaction when reparenting.",
);
}
if !anchor.offset.is_finite() || !(0. ..=1.).contains(&anchor.offset) {
error(
&mut out,
n.id,
"invalid_port_offset",
"port_anchors",
"Port offset must be finite and between zero and one.",
);
}
}
if *key != n.id {
error(
&mut out,