fix(react) fitViewOptions.nodes are now working as intended
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user