refactor(fitView): use same fitView function for viewport helper and initial prop

This commit is contained in:
Christopher Möller
2022-01-27 13:00:03 +01:00
parent 0244c93cb9
commit af52bab2a5
40 changed files with 169 additions and 184 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ import ReactFlow, {
} from 'react-flow-renderer';
import { getElements } from './utils';
const onPaneReady = (reactFlowInstance: ReactFlowInstance) => {
const onInit = (reactFlowInstance: ReactFlowInstance) => {
reactFlowInstance.fitView();
console.log(reactFlowInstance.getNodes());
};
@@ -36,7 +36,7 @@ const EdgeTypesFlow = () => {
edges={edges}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onPaneReady={onPaneReady}
onInit={onInit}
onConnect={onConnect}
minZoom={0.2}
zoomOnScroll={false}