@expofp/floorplan
Version:
Interactive floor plan library for expos and events
76 lines • 3.48 kB
TypeScript
import { type OutdoorPoiFilterState } from './outdoor-poi-filter';
import type RootStore from './RootStore';
/**
* A rendered outdoor PoI marker, shared between the place that creates it
* (`config-outdoor-poi`) and the consumer that renders it as native MapLibre
* symbol/cluster layers (`usePoiMarkers`).
*
* `icon` is the category pin — poiType glyph and Designer color baked in —
* rasterized once at devicePixelRatio and handed to `map.addImage`. (The
* selection pinhead is not per-marker: usePoiMarkers draws one shared image.)
* `center` is the PoI position in SVG/model coordinates (booth rect center);
* everything else about marker state (selection, filtering, clustering) is
* derived at render time from the stores, not stored here.
*/
export interface PoiMarker {
boothId: number;
center: {
x: number;
y: number;
};
icon: ImageData;
}
/**
* Domain store for the current outdoor PoI markers. `config-outdoor-poi`
* publishes the rasterized markers here; `usePoiMarkers` renders them as
* native MapLibre layers, and dimming/filtering read them via MobX.
*
* Selection is not stored: {@link selectedMarkerId} derives it from
* `uiState.selectedBooths` (the single selected booth, if it has a marker),
* so `RootStore.clickBooth` / search selection are the only writers.
*/
export default class PoiMarkerStore {
readonly rootStore: RootStore;
/**
* Backing box for {@link markers}, reference-observed (`deep: false`):
* PoiMarker holds raster data that must not be deep-observed. A box instead of
* an `@observable.ref` field because mobx 5's field-decorator typing
* predates TS standard decorators (the @-form fails to type-check), and the
* runtime `decorate()` alternative silently breaks under native class-field
* (define) semantics, which vitest's transform uses.
*/
private readonly markersBox;
/**
* Monotonic counter bumped by {@link clear}. Async marker producers capture
* it before awaiting and compare before {@link addMany}, so icon loads that
* outlive a scene teardown/rebuild cannot repopulate the store with stale
* markers.
*/
generation: number;
constructor(rootStore: RootStore);
/** The current markers; the array is replaced wholesale, never mutated. */
get markers(): readonly PoiMarker[];
/** Registers a batch of markers with a single change notification. */
addMany(newMarkers: readonly PoiMarker[]): void;
clear(): void;
/**
* The marker shown as the selection pinhead: the single selected booth, if
* exactly one booth is selected and it has an outdoor marker. Multi-select
* (routes, multi-booth exhibitors) shows no per-marker highlight.
*/
get selectedMarkerId(): number | null;
/** Whether an outdoor marker is selected — suppresses venue dimming. */
get selectionActive(): boolean;
/**
* The active poiType filter narrowed to the markers it actually renders.
* Cached: it scans every booth, and the map reads it from several places
* (marker data, camera fit, dimming) on every selection or filter change.
*/
get outdoorFilter(): OutdoorPoiFilterState;
/**
* Dimming is suppressed while an outdoor PoI filter or marker selection is
* active — the whole point of both is to make those markers stand out.
*/
get dimSuppressed(): boolean;
}
//# sourceMappingURL=PoiMarkerStore.d.ts.map