diff --git a/packages/react/src/types/instance.ts b/packages/react/src/types/instance.ts index eac29b91..fdece4dd 100644 --- a/packages/react/src/types/instance.ts +++ b/packages/react/src/types/instance.ts @@ -180,7 +180,7 @@ export type GeneralHelpers Rect; + getNodesBounds: (nodes: (NodeType | InternalNode | string)[]) => Rect; /** * Gets all connections for a given handle belonging to a specific node. * diff --git a/packages/system/src/utils/graph.ts b/packages/system/src/utils/graph.ts index be391219..7efde2e3 100644 --- a/packages/system/src/utils/graph.ts +++ b/packages/system/src/utils/graph.ts @@ -132,9 +132,11 @@ export type GetNodesBoundsParams = { * @returns Bounding box enclosing all nodes */ export const getNodesBounds = (nodes: NodeBase[], params: GetNodesBoundsParams = { nodeOrigin: [0, 0] }): Rect => { - console.warn( - 'This function yields erronous results for subflows. Use getNodesBounds from useReactFlow/useSvelteFlow hook instead.' - ); + if (process.env.NODE_ENV === 'development') { + console.warn( + '[DEPRECATED] `getNodesBounds` is deprecated because it yields erronous results for subflows. Use `getNodesBounds` from useReactFlow/useSvelteFlow hook instead.' + ); + } if (nodes.length === 0) { return { x: 0, y: 0, width: 0, height: 0 };