fix(fitview): handle child nodes closes #2223

This commit is contained in:
moklick
2022-06-21 12:33:05 +02:00
parent dba65f82d1
commit dbd527acd0
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ export function fitView(get: GetState<ReactFlowState>, options: InternalFitViewO
if ((options.initial && !fitViewOnInitDone && fitViewOnInit) || !options.initial) {
if (d3Zoom && d3Selection) {
const nodes = Array.from(nodeInternals.values()).filter((n) =>
options.includeHiddenNodes ? !n.parentNode && n.width && n.height : !n.parentNode && !n.hidden
options.includeHiddenNodes ? n.width && n.height : !n.hidden
);
const nodesInitialized = nodes.every((n) => n.width && n.height);