/** * Pure layout for connector labels. * * Builds candidate label rects for every sub-segment of the (resolved) * polyline, ordered middle-segment-outward, then delegates to placeLabel. */ import type { NormalizedConnectorDef, NormalizedNodeDef } from '../types.js'; import type { GridLayout } from '../geometry/grid.js'; import type { LabelRect, LineSeg, CanvasBounds, Circle } from '../geometry/collision.js'; import { type AttemptRecord } from '../geometry/label-placer.js'; import { type Pixel } from '../geometry/connector-path.js'; export interface ConnectorLabelResult { rect: LabelRect; error: boolean; /** Every (segment, t-position) candidate tried, for diagnostic emission. */ attempts: AttemptRecord[]; } /** Labelled candidate: the pixel rect plus a short "seg 2 / t=0.5 above" * description the pipeline can attach to diagnostics. */ interface AnnotatedRect { rect: LabelRect; description: string; } /** * Build hop order starting from the middle segment and alternating outward. * n=5 segments → [2, 1, 3, 0, 4] */ export declare function hopOrder(n: number): number[]; /** * Candidate rects for a single sub-segment at t-values 0.5, 0.25, 0.75. * * For every direction (horizontal, vertical, diagonal) each t-point * yields TWO candidates — one perpendicular-shifted to each side of the * line — so the placer can escape a busy axis by stepping off it. The * rect stays axis-aligned; only its center moves. * * Horizontal lines retain their familiar "above" / "below" labels in * the candidate descriptions; non-horizontal lines say "side-A" / * "side-B" where side-A sits on the perpendicular's +CCW side of the * line direction. * * Order: t=0.5 is tried first (both sides), then t=0.25 (both sides), * then t=0.75 (both sides). 6 candidates per segment. */ export declare function candidatesForSegment(p1: Pixel, p2: Pixel, labelWidth: number, labelH: number, fontSize: number, strokeWidth: number): AnnotatedRect[]; export declare function computeConnectorLabelRect(connector: NormalizedConnectorDef, nodeMap: Map, layout: GridLayout, placedLabels: LabelRect[], connLines: LineSeg[], pixelWaypoints?: Pixel[], bounds?: CanvasBounds, iconCircles?: Circle[], fromAngleOffset?: number, toAngleOffset?: number): ConnectorLabelResult | null; export {}; //# sourceMappingURL=connector-label.d.ts.map