import { BoardElement, ShapeElement } from './types.js'; /** * Pure geometry for the board scene: bounding boxes, hit testing and * marquee (rectangle) selection. No DOM, no layout reads — safe to call * from a host's pointer-move handler at 60fps (perf rule: pointer callbacks * do zero layout work). * * Rotation handling: an element's `rotation` is around its bbox center. Hit * testing un-rotates the query point into the element's local frame, then * tests against the axis-aligned box — so callers never rotate geometry, * only points. */ interface Point { x: number; y: number; } interface Rect { x: number; y: number; width: number; height: number; } /** Axis-aligned bounding box in scene coordinates (ignores rotation). */ /** * Absolute vertices of a linear shape (line/arrow). Defaults to the two-point * segment (x,y)→(x+width,y+height) when the element has no explicit `points`. */ declare function linearPoints(el: ShapeElement): Point[]; declare function elementBBox(el: BoardElement): Rect; declare function rectCenter(r: Rect): Point; /** Rotate `p` by `rad` around `center`. */ declare function rotatePoint(p: Point, center: Point, rad: number): Point; /** * True if point `p` (scene coords) hits element `el` within `tolerance` * scene units. Strokes use nearest-segment distance; unfilled shapes use a * stroked-outline band; filled shapes, text, formula and image use the bbox. */ declare function hitTest(el: BoardElement, p: Point, tolerance?: number): boolean; /** Rectangle intersection test (AABB). */ declare function rectsIntersect(a: Rect, b: Rect): boolean; /** True if a marquee `r` selects element `el` (bbox intersection). */ declare function rectHits(el: BoardElement, r: Rect): boolean; /** Union bbox of several elements (e.g. a multi-selection). Null if empty. */ declare function unionBBox(elements: BoardElement[]): Rect | null; export { type Point, type Rect, elementBBox, hitTest, linearPoints, rectCenter, rectHits, rectsIntersect, rotatePoint, unionBBox };