refactor(onLoad): add new zoom pan helpers

This commit is contained in:
moklick
2021-12-07 04:05:45 +01:00
parent c2644f16bb
commit d9c99a8a6d
4 changed files with 43 additions and 31 deletions
+5 -1
View File
@@ -8,7 +8,8 @@ import { OnLoad, XYPosition, Node, Edge, FlowExportObject } from '../types';
function useOnLoadHandler(onLoad: OnLoad<any> | undefined) {
const isInitialized = useRef<boolean>(false);
const store = useStoreApi();
const { zoomIn, zoomOut, zoomTo, transform: setTransform, fitView, initialized } = useZoomPanHelper();
const { zoomIn, zoomOut, zoomTo, getZoom, setTransform, getTransform, setCenter, fitView, initialized } =
useZoomPanHelper();
useEffect(() => {
if (!isInitialized.current && initialized) {
@@ -47,7 +48,10 @@ function useOnLoadHandler(onLoad: OnLoad<any> | undefined) {
zoomIn,
zoomOut,
zoomTo,
getZoom,
setTransform,
getTransform,
setCenter,
project,
getNodes,
getEdges,