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

@@ -10,6 +10,7 @@ import {
clampZoom,
ZOOM_STEP_KB
} from '$lib/person/genealogy/panZoom';
import { animateView, prefersReducedMotion } from '$lib/person/genealogy/animateView';
import type { components } from '$lib/generated/api';
type PersonNodeDTO = components['schemas']['PersonNodeDTO'];
@@ -37,8 +38,12 @@ function zoomIn() {
function zoomOut() {
view = { ...view, z: clampZoom(view.z - ZOOM_STEP_KB) };
}
let cancelAnimation = () => {};
function fitToScreen() {
view = DEFAULT_VIEW;
cancelAnimation();
cancelAnimation = animateView(view, DEFAULT_VIEW, (v) => (view = v), {
reducedMotion: prefersReducedMotion()
});
}
</script>