@rxflow/manhattan
Version:
Manhattan routing algorithm for ReactFlow - generates orthogonal paths with obstacle avoidance
53 lines • 1.29 kB
TypeScript
import { Position } from '@xyflow/react';
import type { ManhattanRouterOptions, NodeLookup } from './options';
/**
* Parameters for getManHattanPath function
*/
export interface GetManHattanPathParams {
/**
* Source node ID
*/
sourceNodeId: string;
/**
* Target node ID
*/
targetNodeId: string;
sourceX: number;
sourceY: number;
targetX: number;
targetY: number;
sourcePosition: Position;
targetPosition: Position;
/**
* ReactFlow node lookup map
*/
nodeLookup: NodeLookup;
/**
* Router options
*/
options?: ManhattanRouterOptions;
}
/**
* Generate Manhattan-routed path for ReactFlow edges
*
* @param params - Path generation parameters
* @returns SVG path string that can be used with ReactFlow's BaseEdge
*
* @example
* ```typescript
* const path = getManHattanPath({
* sourceNodeId: 'node1',
* targetNodeId: 'node2',
* sourcePosition: { x: 100, y: 100 },
* targetPosition: { x: 300, y: 300 },
* nodeLookup: nodes,
* options: {
* step: 10,
* startDirections: ['bottom'],
* endDirections: ['top']
* }
* })
* ```
*/
export declare function getManHattanPath(params: GetManHattanPathParams): string;
//# sourceMappingURL=getManHattanPath.d.ts.map