From 0491a55bf6f5d0efa0349181d1ac7b16765bc111 Mon Sep 17 00:00:00 2001 From: William Jeynes Date: Sat, 25 Apr 2026 11:28:53 +0100 Subject: [PATCH] Add show all to time filter. Set default zoom out --- graphviz/frontend/src/VizSmallConnected.tsx | 6 ++++ graphviz/frontend/src/VizTimeFilter.tsx | 38 +++++++++++++++++---- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/graphviz/frontend/src/VizSmallConnected.tsx b/graphviz/frontend/src/VizSmallConnected.tsx index a2ce1c1..60f4eb0 100644 --- a/graphviz/frontend/src/VizSmallConnected.tsx +++ b/graphviz/frontend/src/VizSmallConnected.tsx @@ -151,6 +151,12 @@ export function VizSmallConnected() { fgRef.current.d3ReheatSimulation(); }, [graphData]); + useEffect(() => { + if (fgRef.current) { + fgRef.current.zoom(0.01, 0); + } + }, []); + return (
{ const d = new Date(inputDate); @@ -208,13 +209,19 @@ export function VizTimeFilter() { const set = new Set(); graphData.nodes.forEach((n) => { - if (isNodeHighlighted(n, parsedInputDate)) { + if (showAll || isNodeHighlighted(n, parsedInputDate)) { set.add(n.id); } }); return set; - }, [graphData.nodes, parsedInputDate]); + }, [graphData.nodes, parsedInputDate, showAll]); + + useEffect(() => { + if (fgRef.current) { + fgRef.current.zoom(0.01, 0); + } +}, []); return (
@@ -237,7 +244,6 @@ export function VizTimeFilter() { return bothHighlighted ? "orange" : "rgba(0,0,0,0)"; }} linkWidth={2.5} - onNodeClick={(node) => setSelectedNode(node)} nodeCanvasObject={(node, ctx) => { const label = node.label; @@ -355,8 +361,28 @@ export function VizTimeFilter() { }} /> -
- {new Date(inputDate).toISOString().slice(0, 10)} (± 6 months window) +
+ + {new Date(inputDate).toISOString().slice(0, 10)} (± 6 months window) + + +