This commit is contained in:
33333-33333 2026-07-01 16:55:49 +09:00
commit c9dd7182aa
35 changed files with 478 additions and 288 deletions

View file

@ -91,19 +91,25 @@ function lineageBuildLinksFast(nodes, idSet, layout) {
childLinkEdges += parents.length;
const childX = childPos.x + nodeW / 2;
const childY = childPos.y;
const fromY = Math.max(...parents.map(p => p.y + nodeH));
const joinX = parents.reduce((sum, p) => sum + p.x + nodeW / 2, 0) / parents.length;
let fromY = Math.max(...parents.map(p => p.y + nodeH));
let joinX = parents.reduce((sum, p) => sum + p.x + nodeW / 2, 0) / parents.length;
if (parents.length >= 2) {
const left = parents[0];
const right = parents[parents.length - 1];
const partnerKey = parents.map(p => p.node?.id).filter(Boolean).sort().join("+");
if (partnerKey && !seenPartners.has(partnerKey)) {
seenPartners.add(partnerKey);
const y = ((left.y + nodeH / 2) + (right.y + nodeH / 2)) / 2;
partnerLinks.push(`M ${(left.x + nodeW).toFixed(1)} ${y.toFixed(1)} L ${right.x.toFixed(1)} ${y.toFixed(1)}`);
const y = ((left.y + nodeH / 2) + (right.y + nodeH / 2)) / 2;
const x1 = left.x + nodeW;
const x2 = right.x;
if (x2 > x1) {
joinX = clamp(joinX, x1 + 8, x2 - 8);
fromY = y;
if (partnerKey && !seenPartners.has(partnerKey)) {
seenPartners.add(partnerKey);
partnerLinks.push(`M ${x1.toFixed(1)} ${y.toFixed(1)} L ${x2.toFixed(1)} ${y.toFixed(1)}`);
}
}
}
const laneY = Math.min(childY - 18, fromY + Math.max(28, (childY - fromY) * 0.48));
const laneY = Math.min(childY - 22, fromY + Math.max(36, (childY - fromY) * 0.54));
childLinks.push(`M ${joinX.toFixed(1)} ${fromY.toFixed(1)} L ${joinX.toFixed(1)} ${laneY.toFixed(1)} L ${childX.toFixed(1)} ${laneY.toFixed(1)} L ${childX.toFixed(1)} ${childY.toFixed(1)}`);
}
return { partnerLinks, childLinks, childLinkGroups, childLinkEdges };