react-force-graph icon indicating copy to clipboard operation
react-force-graph copied to clipboard

How to zoom in and out properly when entering and exiting full screen mode?

Open wadeewang opened this issue 1 year ago • 2 comments

Why can't zoomTofit api be used in react-force-grapg-2d?

wadeewang avatar Sep 11 '24 14:09 wadeewang

@vasturiano thanks for reaching out.

zoomToFit is a component method for react-force-graph-2d. In fact, you can see it working in this example: https://github.com/vasturiano/react-force-graph/blob/master/example/fit-to-canvas/index.html

If you're having some trouble getting it to work, please provide a simple example on https://codesandbox.io/.

vasturiano avatar Sep 18 '24 20:09 vasturiano

@W-HanYu For zoomToFit() methods, <ForceGraphref={graphRef}/>

This will occur when a graph instance, graphRef.current, exists. In the case of react, it seems that it will be available after useEffect or onEngineStop.

hyeonbeomsong avatar Oct 18 '24 06:10 hyeonbeomsong