From f065c65099d1da8bb13c0f295d3e2f5fdfd0ad76 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 17 Jun 2020 20:06:13 +0200 Subject: [PATCH] fitView argument is optional --- src/store/index.ts | 3 ++- src/types/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 7dec4ecd..bb5486c2 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -376,7 +376,8 @@ export const storeModel: StoreModel = { state.isInteractive = isInteractive; }), - fitView: action((state, { padding = 0.1 }) => { + fitView: action((state, payload = { padding: 0.1 }) => { + const { padding } = payload; const { nodes, width, height, d3Selection, d3Zoom } = state; if (!d3Selection || !d3Zoom || !nodes.length) { diff --git a/src/types/index.ts b/src/types/index.ts index 050ad740..c82983a4 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -134,9 +134,9 @@ export interface WrapNodeProps { } export type FitViewParams = { - padding?: number; + padding: number; }; -export type FitViewFunc = (fitViewOptions: FitViewParams) => void; +export type FitViewFunc = (fitViewOptions?: FitViewParams) => void; export type ProjectFunc = (position: XYPosition) => XYPosition; type OnLoadParams = {