import type { MapRenderer } from 'mudlet-map-renderer'; import type { MudletMap } from '../mapIO'; import type { Direction, HitItem, LabelResizeHandle } from './types'; import type { EditorMapReader } from './reader/EditorMapReader'; /** * Hit-test map labels. Labels are axis-aligned rects. Returns the topmost label * (last in the list, rendered on top) whose render-space rect contains (mapX, mapY). * MapData.Label stores X/Y in Mudlet space; render position is (X, -Y). */ export declare function labelAt(areaId: number, z: number, mapX: number, mapY: number, reader: EditorMapReader): { id: number; areaId: number; } | null; /** * Like labelAt but returns ALL labels whose rect contains (mapX, mapY), in * draw order (topmost — last in the list — is last in the returned array). */ export declare function allLabelsAt(areaId: number, z: number, mapX: number, mapY: number, reader: EditorMapReader): { id: number; areaId: number; }[]; /** * Returns ALL elements under (mapX, mapY) in visual-priority order: * 1. All rooms occupying the same grid cell (stacked rooms) * 2. All overlapping labels (topmost first) * 3. Custom line (if any) * 4. Exit (if any) * Used for Alt+click cycling and the right-click disambiguate menu. */ export declare function allHitsAt(renderer: MapRenderer, map: MudletMap, areaId: number, z: number, mapX: number, mapY: number, roomSize: number, reader: EditorMapReader): HitItem[]; /** * 8 handle positions relative to a label's padded selection rect. * Returns the handle under the cursor, or null. * `hitRadius` is the capture radius in map units (typically 8px worth of units). */ export declare function labelResizeHandleAt(bounds: { x: number; y: number; w: number; h: number; }, mapX: number, mapY: number, hitRadius: number): LabelResizeHandle | null; /** Does any room occupy the exact raw grid cell (x, y, z) on the given area? */ export declare function roomAtCell(map: MudletMap, areaId: number, x: number, y: number, z: number): import("mudlet-map-binary-reader").MudletRoom | null; /** * 8 handle offsets (signs relative to room centre, each scaled by roomSize/2). * Used both for hit-testing and for rendering the ConnectHandlesEffect. */ export declare const HANDLE_OFFSETS: ReadonlyArray; /** * Given a cursor in render space and a room's render-space centre, return * which handle direction the cursor is pointing at. Assumes the caller has * already established the cursor is within the room's hit-test region — this * function just maps the angular offset to one of 8 sectors, so there is * never a "body" / null result and the direction transitions smoothly around * the room. */ export declare function handleDirFor(cursor: { x: number; y: number; }, roomCentre: { x: number; y: number; }, _roomSize: number): Direction; /** * Hit-test an inter-room exit against the geometry the renderer actually * drew. Walks every polyline segment of every drawn exit's `lines` and * `arrows` so dashed lines, one-way arrows, cross-z stubs, and the * renderer's suppression rules (e.g. both-sides-customLine two-ways) are * honoured by construction — we never hover an exit that wasn't rendered. */ export declare function exitAt(renderer: MapRenderer, mapX: number, mapY: number, roomSize: number): { fromId: number; toId: number; dir: Direction; } | null; /** * Hit-test a custom line polyline against the geometry the renderer drew. * `points` on each drawn entry already mirror what went to the canvas — * including the prepended room-centre segment — so stroke style doesn't * matter; we just walk segments. */ export declare function customLineAt(renderer: MapRenderer, mapX: number, mapY: number, roomSize: number): { roomId: number; exitName: string; } | null; /** * Hit-test a line segment of a specific custom line. Returns the raw-points * index at which a new waypoint should be inserted so it lands on the clicked * segment (between waypoint `insertIndex - 1` and `insertIndex`). Waypoint * handles are skipped — caller should check `customLinePointAt` first. */ export declare function customLineSegmentAt(renderer: MapRenderer, roomId: number, exitName: string, mapX: number, mapY: number, roomSize: number): { insertIndex: number; } | null; /** * Hit-test a waypoint handle on a specific custom line. Returns the 0-based * index into the *raw* customLine.points array (which excludes the * renderer-prepended room centre), or null. */ export declare function customLinePointAt(renderer: MapRenderer, roomId: number, exitName: string, mapX: number, mapY: number, roomSize: number): number | null; /** * Hit-test a `room.stubs` entry against the geometry the renderer actually * drew. Non-cardinal stubs (up/down/in/out) render as zero-length segments * and are implicitly skipped by the distance check. */ export declare function stubAt(renderer: MapRenderer, mapX: number, mapY: number, roomSize: number): { roomId: number; dir: Direction; } | null;