fix(react) fitViewOptions.nodes are now working as intended

This commit is contained in:
Peter
2023-09-25 13:46:22 +02:00
parent ada5b94673
commit 439916e619
5 changed files with 7 additions and 10 deletions
+3 -3
View File
@@ -82,7 +82,7 @@ const createRFStore = () =>
let nextFitViewDone = fitViewDone;
if (!fitViewDone && fitViewOnInit) {
nextFitViewDone = fitView({
nextFitViewDone = fitView(nextNodes, {
...fitViewOnInitOptions,
nodes: fitViewOnInitOptions?.nodes || nextNodes,
});
@@ -241,8 +241,8 @@ const createRFStore = () =>
const { transform, width, height, panZoom, translateExtent } = get();
return panBySystem({ delta, panZoom, transform, translateExtent, width, height });
},
fitView: (options?: FitViewOptions): boolean => {
const { panZoom, nodes, width, height, minZoom, maxZoom, nodeOrigin } = get();
fitView: (nodes: Node[], options?: FitViewOptions): boolean => {
const { panZoom, width, height, minZoom, maxZoom, nodeOrigin } = get();
if (!panZoom) {
return false;
+1 -1
View File
@@ -155,7 +155,7 @@ export type ReactFlowActions = {
reset: () => void;
triggerNodeChanges: (changes: NodeChange[]) => void;
panBy: PanBy;
fitView: (options?: FitViewOptions) => boolean;
fitView: (nodes: Node[], options?: FitViewOptions) => boolean;
};
export type ReactFlowState = ReactFlowStore & ReactFlowActions;