Merge pull request 'Fix fly-to vertical centering at non-1 zoom levels' (#250) from fix-fly-to-vertical-centering into main
build-frontend / build (push) Successful in 1m28s

This commit was merged in pull request #250.
This commit is contained in:
2026-06-11 08:58:38 -04:00
+5 -1
View File
@@ -315,8 +315,12 @@ export default function TreePage() {
try { try {
const rect = svg.getBoundingClientRect(); const rect = svg.getBoundingClientRect();
const scale = handlers.getCurrentZoom ? handlers.getCurrentZoom(svg).k : 1; 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·(k1) otherwise — landing "below the
// tree". Pre-multiply y by the scale to cancel the missing ·k.
handlers.cardToMiddle({ handlers.cardToMiddle({
datum: xy, datum: { x: xy.x, y: xy.y * scale },
svg, svg,
svg_dim: { width: rect.width, height: rect.height }, svg_dim: { width: rect.width, height: rect.height },
scale, scale,