fix(core): exclude hidden nodes in fitView when includeHiddenNodes is false

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-07 12:28:47 +01:00
committed by Braks
parent bb2c4f449a
commit 26f16b75f8
@@ -107,13 +107,10 @@ export default (vueFlowId?: string): ViewportFunctions => {
if (!getNodes.length) return
let nodeBounds: GraphNode[] = []
if (options.nodes) {
nodeBounds = nodes.filter((n) => options.nodes?.includes(n.id))
}
let nodeBounds: GraphNode[] = options.includeHiddenNodes ? nodes.filter((n) => n.width && n.height) : getNodes
if (!nodeBounds || !nodeBounds.length) {
nodeBounds = options.includeHiddenNodes ? nodeBounds : getNodes
if (options.nodes) {
nodeBounds = nodeBounds.filter((n) => options.nodes?.includes(n.id))
}
const bounds = getRectOfNodes(nodeBounds)