/** * Single source of truth for a connector's polyline geometry. * * Every consumer (line rendering, label placement, midpoint lookup, * collision detection) must derive coordinates from `resolveConnectorPath` * so that the rendered line and its computed metadata stay in lockstep. */ import type { NormalizedConnectorDef, NormalizedNodeDef } from '../types.js'; import type { GridLayout } from './grid.js'; import type { LineSeg } from './collision.js'; export interface Pixel { x: number; y: number; } export interface ResolvedPath { /** Raw polyline (node centers + waypoints) before pull-back */ raw: Pixel[]; /** Polyline with first/last point pulled back to the node edges */ points: Pixel[]; } /** * Optional shaping inputs for `resolveConnectorPath`. Both fields are * "advanced" — the common case (a plain connector with no waypoints) * passes neither. */ export interface ResolveConnectorPathOpts { /** Pixel waypoints from a routed-path solver. When set, overrides * the connector's own `waypoints`. */ pixelWaypoints?: Pixel[]; /** * Rotate the FROM-end's pulled-back endpoint around the source node * center by this many radians (positive = CCW in screen coords). * Used by overlap-split to shift two paired connectors' connection * points to opposite sides of the canonical centerline so the lines * separate visually while staying straight. */ fromAngleOffset?: number; /** Same as `fromAngleOffset`, applied at the TO end. */ toAngleOffset?: number; } /** * Resolve the rendered polyline of a connector. Returns null when * either endpoint is missing from the node map (callers treat this as * "skip / nothing to render"). * * Optional `opts.pixelWaypoints` (when given) overrides the connector's * own waypoints — used by routed connectors to plug in router output. * Optional `opts.fromAngleOffset` / `opts.toAngleOffset` rotate the * pulled-back endpoints around their respective node centers (overlap * split uses this to shift connection points perpendicular to the * canonical line). * * Legacy positional `pixelWaypoints` argument is still accepted for * backwards compatibility with the many existing call sites. */ export declare function resolveConnectorPath(conn: NormalizedConnectorDef, nodeMap: Map, layout: GridLayout, pixelWaypointsOrOpts?: Pixel[] | ResolveConnectorPathOpts): ResolvedPath | null; /** Convert a polyline to pairwise line segments. */ export declare function polylineToSegments(points: Pixel[]): LineSeg[]; /** * Midpoint of the connector's central segment. * * Operates on the raw polyline (node centers, not pulled back) — used * for "where does this connector live" queries like Note leader-line * targets. */ export declare function rawMidpoint(path: ResolvedPath): Pixel; //# sourceMappingURL=connector-path.d.ts.map