UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

51 lines 2.45 kB
import type { IconProvider } from "../adapters"; import type { RouteEndpoint, RouteLine, RoutePoint, RouteSnapResult } from "../core"; import type { WayfindingRenderer } from "../renderer"; import type { FloorContext, PositionInput } from "./types"; import type { TrailView } from "./trailView"; /** * Snapshot of the visible route the position-trail view operates on. The runtime computes it * (visibility filtering, route-points derivation) and passes it in so the view stays free of * route-state knowledge. */ export interface RouteSnapshot { readonly from: RouteEndpoint; readonly to: RouteEndpoint; readonly routePoints: ReadonlyArray<RoutePoint>; readonly visibleLines: ReadonlyArray<RouteLine>; } /** * Owns the user-position icon and the single off-graph trail slot. The runtime decides which end of * the route needs a trail (kiosk FROM, kiosk TO, or off-route CP FROM — never both at once in * practice) and passes the corresponding `tip` + `anchor` here. */ interface PositionTrailView { /** Place the position icon at the raw position. */ placeIcon(position: PositionInput): void; /** Hide the position icon. */ hideIcon(): void; /** * Snap the position to `routeLines` (caller-provided — typically the full non-virtual route * across all floors) and place the position icon at the snap point or at the raw position. * Returns the snap result; the trail is **not** touched — call `setTrail` separately. * * `routeLines` is decoupled from `route.visibleLines` so the snap stays correct regardless of * which floor is currently selected in the UI. */ applyToRoute(position: PositionInput, route: RouteSnapshot, routeLines: ReadonlyArray<RouteLine>): RouteSnapResult; /** Draw the trail from `tip` (a route's graph endpoint) to `anchor` (the off-graph point). * Passing either as null hides the trail. */ setTrail(tip: RoutePoint | null, anchor: RoutePoint | null): void; /** Clear the trail slot (does not touch the icon). */ clearTrail(): void; } export declare function createPositionTrailView({ renderer, iconProvider, floorContext, trails, iconLayer, snapThreshold, }: { renderer: WayfindingRenderer; iconProvider: IconProvider; floorContext: FloorContext; trails: TrailView; iconLayer: string; snapThreshold: number; }): PositionTrailView; export {}; //# sourceMappingURL=positionTrailView.d.ts.map