refactor(general): fit view in store to prevent flickering, rename onLoad => onPaneReady

This commit is contained in:
moklick
2021-12-09 07:24:45 +01:00
parent 3a52efbb1f
commit 88582a86cc
17 changed files with 96 additions and 100 deletions
+6 -2
View File
@@ -29,7 +29,7 @@ export type ZoomTo = (zoomLevel: number, options?: ZoomPanHelperFunctionOptions)
export type SetTransform = (transform: FlowTransform, options?: ZoomPanHelperFunctionOptions) => void;
export type SetCenter = (x: number, y: number, options?: SetCenterOptions) => void;
export type OnLoadParams<T = any> = {
export type ReactFlowInstance<T = any> = {
zoomIn: ZoomInOut;
zoomOut: ZoomInOut;
zoomTo: ZoomTo;
@@ -44,7 +44,7 @@ export type OnLoadParams<T = any> = {
toObject: ToObject<T>;
};
export type OnLoad<T = any> = (params: OnLoadParams<T>) => void;
export type OnPaneReady<T = any> = (reactFlowInstance: ReactFlowInstance<T>) => void;
export interface Connection {
source: string | null;
@@ -183,6 +183,9 @@ export type ReactFlowStore = {
multiSelectionActive: boolean;
reactFlowVersion: string;
fitViewOnInit: boolean;
fitViewOnInitDone: boolean;
};
export type ReactFlowActions = {
@@ -226,6 +229,7 @@ export type ReactFlowActions = {
onConnectEnd?: OnConnectEnd;
reset: () => void;
setFitViewOnInit: (fitViewOnInit: boolean) => void;
};
export type ReactFlowState = ReactFlowStore & ReactFlowActions;
+1 -1
View File
@@ -8,8 +8,8 @@ import { HandleElement } from './handles';
export interface Node<T = any> {
id: string;
position: XYPosition;
data: T;
type?: string;
data?: T;
style?: CSSProperties;
className?: string;
targetPosition?: Position;