feat(stammbaum): land a fresh visit at readable z=3, keep fit-to-screen at z=1 (#692)

A fresh visit (no URL state) now opens at INITIAL_VIEW (z=3) so node tiles and
generation labels are legible on arrival; the fit-to-screen control still zooms
out to the whole tree (DEFAULT_VIEW, z=1). Shared links with ?z still win.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-29 18:00:17 +02:00
parent 578bebbd8b
commit bb2a89da58
3 changed files with 24 additions and 13 deletions

View File

@@ -28,9 +28,17 @@ export const ZOOM_STEP_KB = 0.1;
*/
export type PanZoomState = { x: number; y: number; z: number };
/** Fit-to-screen / initial view (US-PAN-004). */
/** Fit-to-screen target — frames the whole tree at z=1 (US-PAN-004). */
export const DEFAULT_VIEW: PanZoomState = { x: 0, y: 0, z: DEFAULT_ZOOM };
/**
* Landing zoom for a fresh visit (no URL state). Higher than fit so node tiles
* and generation labels are legible on arrival; the fit-to-screen control
* (DEFAULT_VIEW, z=1) zooms back out to the whole tree.
*/
export const INITIAL_ZOOM = 3;
export const INITIAL_VIEW: PanZoomState = { x: 0, y: 0, z: INITIAL_ZOOM };
/** Clamp a zoom factor into the supported range. */
export function clampZoom(z: number): number {
return Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, z));