UNPKG

@jalez/react-flow-smart-edge

Version:

Smart edge routing for @xyflow/react v12+ (maintained fork of @tisoap/react-flow-smart-edge)

36 lines (35 loc) 1.02 kB
import type { Node, XYPosition } from '@xyflow/react'; export type NodeBoundingBox = { id: string; width: number; height: number; topLeft: XYPosition; bottomLeft: XYPosition; topRight: XYPosition; bottomRight: XYPosition; }; export type GraphBoundingBox = { width: number; height: number; topLeft: XYPosition; bottomLeft: XYPosition; topRight: XYPosition; bottomRight: XYPosition; xMax: number; yMax: number; xMin: number; yMin: number; }; /** * Get the bounding box of all nodes and the graph itself, as X/Y coordinates * of all corner points. * * @param nodes The node list * @param nodePadding Optional padding to add to the node's and graph bounding boxes * @param roundTo Everything will be rounded to this nearest integer * @returns Graph and nodes bounding boxes. */ export declare const getBoundingBoxes: (nodes: Node[], nodePadding?: number, roundTo?: number) => { nodeBoxes: NodeBoundingBox[]; graphBox: GraphBoundingBox; };