getNodesBounds()
The getNodesBounds util returns the bounding Rect
that contains all of the given nodes — handy for centering the view on a subset of
nodes or measuring a group.
import { getNodesBounds, useVueFlow } from '@xyflow/vue';
const { getNodes } = useVueFlow();
const bounds = getNodesBounds(getNodes.value);Signature
Parameters:| Name | Type | Default |
|---|---|---|
nodes | (string | NodeType | InternalNodeBase<NodeType>)[]Nodes to calculate the bounds for. | |
params.nodeOrigin | NodeOriginOrigin of the nodes: | [0, 0] |
params.nodeLookup | NodeLookup<InternalNodeBase<NodeType>> |