feat(stammbaum): server-clamped initial view from ?cx&cy&z (#692)
The server load parses and sanitises the shareable pan/zoom params (degrading Infinity/NaN, clamping zoom) into initialView, which seeds the page view. A crafted link can no longer blank the SVG (Nora). US-PANEL-002 AC2 groundwork. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ type PersonNodeDTO = components['schemas']['PersonNodeDTO'];
|
||||
type RelationshipDTO = components['schemas']['RelationshipDTO'];
|
||||
|
||||
interface Props {
|
||||
data: { nodes: PersonNodeDTO[]; edges: RelationshipDTO[] };
|
||||
data: { nodes: PersonNodeDTO[]; edges: RelationshipDTO[]; initialView: PanZoomState };
|
||||
}
|
||||
|
||||
let { data }: Props = $props();
|
||||
@@ -31,7 +31,7 @@ let selectedId = $state<string | null>(
|
||||
|
||||
const selectedNode = $derived(data.nodes.find((n) => n.id === selectedId) ?? null);
|
||||
|
||||
let view = $state<PanZoomState>(DEFAULT_VIEW);
|
||||
let view = $state<PanZoomState>(data.initialView);
|
||||
function zoomIn() {
|
||||
view = { ...view, z: clampZoom(view.z + ZOOM_STEP_KB) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user