Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat(app): autocenter on load + always allow drag

dextmorgned42a3b2c120
diff --git a/flowsint-app/src/components/graphs/graph-viewer.tsx b/flowsint-app/src/components/graphs/graph-viewer.tsx
index 9ec617ec..bd6ddc01 100644
--- a/flowsint-app/src/components/graphs/graph-viewer.tsx
+++ b/flowsint-app/src/components/graphs/graph-viewer.tsx
@@ -493,6 +493,20 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
}
}, [initializeGraph, instanceId, setActions])
+ // Auto-center graph on initial load
+ useEffect(() => {
+ // Only auto-center if we have nodes and the graph is ready
+ if (graphRef.current && graphData.nodes.length > 0 && containerSize.width > 0) {
+ // Wait a bit for the simulation to settle, then center
+ const timer = setTimeout(() => {
+ if (graphRef.current && typeof graphRef.current.zoomToFit === 'function') {
+ graphRef.current.zoomToFit(400)
+ }
+ }, 500)
+ return () => clearTimeout(timer)
+ }
+ }, [graphData.nodes.length, containerSize.width])
+
// Event handlers with proper memoization
const handleNodeClick = useCallback(
(node: any, event: MouseEvent) => {
@@ -1066,7 +1080,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
onZoom={handleZoom}
onZoomEnd={handleZoom}
linkCanvasObject={renderLink}
- enableNodeDrag={!shouldUseSimpleRendering}
+ enableNodeDrag={true}
autoPauseRedraw={true}
onNodeHover={handleNodeHoverWithTooltip}
onLinkHover={handleLinkHover}