@jalez/react-flow-smart-edge
Version:
Smart edge routing for @xyflow/react v12+ (maintained fork of @tisoap/react-flow-smart-edge)
21 lines (20 loc) • 866 B
TypeScript
import type { PathFindingFunction, SVGDrawFunction } from '../functions';
import type { Node, EdgeProps } from '@xyflow/react';
export type EdgeParams = Pick<EdgeProps, 'sourceX' | 'sourceY' | 'targetX' | 'targetY' | 'sourcePosition' | 'targetPosition'>;
export type GetSmartEdgeOptions = {
gridRatio?: number;
nodePadding?: number;
drawEdge?: SVGDrawFunction;
generatePath?: PathFindingFunction;
};
export type GetSmartEdgeParams = EdgeParams & {
options?: GetSmartEdgeOptions;
nodes: Node[];
};
export type GetSmartEdgeReturn = {
svgPathString: string;
edgeCenterX: number;
edgeCenterY: number;
};
export declare const getSmartEdge: ({ options, nodes, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition }: GetSmartEdgeParams) => GetSmartEdgeReturn | null;
export type GetSmartEdgeFunction = typeof getSmartEdge;