diff --git a/frontend/app/trees/[id]/tree/page.tsx b/frontend/app/trees/[id]/tree/page.tsx index 2baeef1..02b3c35 100644 --- a/frontend/app/trees/[id]/tree/page.tsx +++ b/frontend/app/trees/[id]/tree/page.tsx @@ -315,8 +315,12 @@ export default function TreePage() { try { const rect = svg.getBoundingClientRect(); const scale = handlers.getCurrentZoom ? handlers.getCurrentZoom(svg).k : 1; + // family-chart's cardToMiddle scales datum.x by the zoom but NOT + // datum.y (a library bug), so vertical centering is only correct at + // scale 1 and drifts by datum.y·(k−1) otherwise — landing "below the + // tree". Pre-multiply y by the scale to cancel the missing ·k. handlers.cardToMiddle({ - datum: xy, + datum: { x: xy.x, y: xy.y * scale }, svg, svg_dim: { width: rect.width, height: rect.height }, scale,