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:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user