feat(stammbaum): animate fit-to-screen, snap under reduced motion (#692)

Fit-to-screen tweens to the default view over 300ms via animateView (eased,
lerpView-driven) and snaps instantly when prefers-reduced-motion is set
(US-PAN-004 AC2, NFR-A11Y-003).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-29 16:54:34 +02:00
parent 7a6c2e877f
commit 396c87f8ab
5 changed files with 85 additions and 1 deletions

View File

@@ -113,6 +113,15 @@ export function zoomAtPoint(
};
}
/** Linearly interpolate between two view states (drives fit/recentre tweening). */
export function lerpView(from: PanZoomState, to: PanZoomState, t: number): PanZoomState {
return {
x: from.x + (to.x - from.x) * t,
y: from.y + (to.y - from.y) * t,
z: from.z + (to.z - from.z) * t
};
}
/**
* Clamp the pan offset so the canvas cannot be dragged off the edge (US-PAN-001
* AC4 — no infinite scroll). The pannable range on each axis is half the