fitView argument is optional

This commit is contained in:
Andy
2020-06-19 01:14:15 +02:00
committed by andys8
parent 8db36de6bb
commit f065c65099
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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) {
+2 -2
View File
@@ -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 = {