diff --git a/packages/graphin/public/main.tsx b/packages/graphin/public/main.tsx index 839d26e9..77fecca2 100644 --- a/packages/graphin/public/main.tsx +++ b/packages/graphin/public/main.tsx @@ -97,6 +97,7 @@ const Demo: React.FC = () => { className="graphin-container" style={{ width: '100%', height: '100%' }} options={{ + autoResize: true, data, layout, behaviors: ['zoom-canvas', 'drag-canvas'], diff --git a/packages/graphin/src/hooks/useGraph.ts b/packages/graphin/src/hooks/useGraph.ts index ed922be7..2a57557c 100644 --- a/packages/graphin/src/hooks/useGraph.ts +++ b/packages/graphin/src/hooks/useGraph.ts @@ -16,7 +16,7 @@ export default function useGraph
(props: P) { useEffect(() => { if (graphRef.current || !containerRef.current) return; - const graph = new Graph({ container: containerRef.current! }); + const graph = new Graph({ container: containerRef.current!, ...options }); graphRef.current = graph; setIsReady(true);