@expofp/floorplan
Version:
Interactive floor plan library for expos and events
42 lines • 2.2 kB
TypeScript
import { type ImageDef, type RenderableDef, type SceneDef } from '@expofp/renderer';
import { type FloorPlanMarkerEvent } from '../../../../types';
export declare const MARKER_LAYER_NAME = "markers";
/** What {@link configMarkers} needs: the scene whose root layers hold the marker layer. */
export interface MarkerOptions {
/** The scene markers are drawn into; `config-all` pre-creates their layer in it. */
readonly scene: SceneDef;
}
/**
* Sizes one marker for a new pixel size — the `onScale` every marker def declares.
*
* One function for every marker on the plan, reached through each marker's own `onScale` closure
* and driven directly by the imperative bridge. Idempotent, because the center and rotation it
* reads back are the ones it wrote.
* @param marker - The marker to size.
* @param size - The icon's size in CSS pixels. Not the canvas's: that is rasterized at the device
* ratio.
* @param pixelSize - Plan units per CSS pixel.
* @returns The def, which always moves — a marker holds its on-screen size at every zoom.
*/
export declare function rescaleMarker(marker: ImageDef, size: {
readonly width: number;
readonly height: number;
}, pixelSize: number): readonly RenderableDef[];
/**
* Draws the plan's markers into a renderer scene and keeps them current with the store.
* @param options - The scene to draw into.
* @returns A disposer.
*/
export declare function configMarkers(options: MarkerOptions): () => void;
/**
* The marker a click on the plan landed on, at the size markers are currently drawn.
*
* The pixel size comes from the marker layer's own handler rather than from a renderer the plan holds
* a reference to — which is the whole of what this adds over {@link getMarkerFromClick}.
* @param x - Where the click landed, in plan units.
* @param y - Where the click landed, in plan units.
* @returns The marker, or `null` when the click reached none.
*/
export declare function markerAt(x: number, y: number): FloorPlanMarkerEvent | null;
export declare function getMarkerFromClick(x: number, y: number, scale: number): import("../../../../store/RouteStore").Marker | null;
//# sourceMappingURL=config-markers.d.ts.map