This commit is contained in:
seb
2026-07-31 05:19:14 +02:00
parent 52b9d125f7
commit 142e73a171
5 changed files with 1101 additions and 1027 deletions

View File

@@ -488,6 +488,13 @@ function assignEdgeAnchors(edges, positions) {
});
group.forEach((edge, i) => {
// Self-loops: leave via top diagonals so the arc sits above the table
// instead of curling SE into neighboring edges.
if (edge.from === edge.to) {
tailCompass.set(edgeKey(edge), i % 2 === 0 ? 'ne' : 'nw');
return;
}
const fromX = positions?.get(edge.from)?.x ?? 0;
const toX = positions?.get(edge.to)?.x ?? fromX;
const fromY = positions?.get(edge.from)?.y ?? 0;
@@ -641,6 +648,16 @@ function buildDot(tables, edges, positions = null) {
attrs.push('style=dashed', 'label="inferred"');
}
// Self-FK: leave the FK column, enter the PK — loop on the east side
// of those rows (e→e). Node-level ne→nw looked above the table but
// detached from the actual columns; column→header with :ne still dipped SE.
if (edge.from === edge.to) {
lines.push(
` ${edge.from}:${sourcePort}:e -> ${edge.to}:id:e [${attrs.join(', ')}];`
);
continue;
}
lines.push(
` ${edge.from}:${sourcePort}:${tail} -> ${edge.to}:${targetPort}:n [${attrs.join(', ')}];`
);