fix(subflows): adjust positions before call fit view closes #2737

This commit is contained in:
moklick
2023-01-10 12:39:37 +01:00
parent 791e3f8638
commit f33cd6e3ac
3 changed files with 40 additions and 33 deletions
+3 -1
View File
@@ -3,7 +3,7 @@ import { createStore } from 'zustand';
import { clampPosition, getDimensions, internalsSymbol } from '../utils';
import { applyNodeChanges, createSelectionChange, getSelectionChanges } from '../utils/changes';
import { getHandleBounds } from '../components/Nodes/utils';
import { createNodeInternals, fitView, updateNodesAndEdgesSelections } from './utils';
import { createNodeInternals, fitView, updateAbsoluteNodePositions, updateNodesAndEdgesSelections } from './utils';
import initialState from './initialState';
import type {
ReactFlowState,
@@ -99,6 +99,8 @@ const createRFStore = () =>
return res;
}, []);
updateAbsoluteNodePositions(nodeInternals, nodeOrigin);
const nextFitViewOnInitDone =
fitViewOnInitDone ||
(fitViewOnInit && !fitViewOnInitDone && fitView(get, { initial: true, ...fitViewOnInitOptions }));