From 2fee4c35ae9259c06fe231c50f917cd0f2167961 Mon Sep 17 00:00:00 2001 From: moklick Date: Sat, 25 Jul 2020 13:38:55 +0200 Subject: [PATCH] feat(onLoad): add setTransform function #358 --- src/container/GraphView/index.tsx | 2 ++ src/types/index.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/container/GraphView/index.tsx b/src/container/GraphView/index.tsx index 080d3921..b8503fc7 100644 --- a/src/container/GraphView/index.tsx +++ b/src/container/GraphView/index.tsx @@ -183,6 +183,8 @@ const GraphView = memo( zoomOut: () => zoom(-0.2), project, getElements, + setTransform: (transform: FlowTransform) => + setInitTransform({ x: transform.x, y: transform.y, k: transform.zoom }), }); } diff --git a/src/types/index.ts b/src/types/index.ts index a362abaf..e4ce87ab 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -175,6 +175,7 @@ type OnLoadParams = { fitView: FitViewFunc; project: ProjectFunc; getElements: () => Elements; + setTransform: (transform: FlowTransform) => void; }; export type OnLoadFunc = (params: OnLoadParams) => void;