@expofp/floorplan
Version:
Interactive floor plan library for expos and events
69 lines • 2.59 kB
TypeScript
import type RootStore from './RootStore';
export type MaplibreViewMode = 'floorplan' | 'map2d' | 'map3d';
/** The MapLibre camera framing, in the map's own terms. */
export interface MaplibreCameraState {
lng: number;
lat: number;
zoom: number;
/** Degrees. */
bearing: number;
/** Degrees. */
pitch: number;
}
/**
* A framing to move the camera to. `bearing` and `pitch` are optional because a
* kiosk saved before those fields existed carries neither.
*/
export interface MaplibreCameraTarget {
lng: number;
lat: number;
zoom: number;
/** Degrees; omitted falls back to the venue bearing. */
bearing?: number;
/** Degrees; omitted falls back to the view mode's default pitch. */
pitch?: number;
}
/**
* Read/write access to the live MapLibre camera, registered by MaplibreAdapter
* once the map is up. In map mode the renderer runs in the renderer's external
* mode, where `renderer.controls` is a no-op stub that reports a zeroed camera —
* so anything that has to capture or restore the camera (the kiosk home framing)
* must go through the map itself.
*/
export interface MaplibreCameraPort {
getCameraState(): MaplibreCameraState;
applyCameraState(target: MaplibreCameraTarget): void;
/**
* Snaps pitch back to the view mode's default, leaving center/zoom/bearing
* alone — for the "fit the venue" fallback, which restores a framing through
* `moveToRect` (bearing only) and would otherwise leave a map3d kiosk tilted.
* Call it before starting that fit, not after: MapLibre runs one move at a
* time.
*/
resetPitch(): void;
}
export default class MaplibreStore {
rootStore: RootStore;
mapViewMode: MaplibreViewMode;
maplibreSelected: boolean;
isOnline: boolean;
private readonly cameraPortBox;
private readonly handleOnline;
private readonly handleOffline;
constructor(rootStore: RootStore);
dispose(): void;
setOnline(isOnline: boolean): void;
get cameraPort(): MaplibreCameraPort | null;
setCameraPort(port: MaplibreCameraPort): void;
/** Clears only if `port` is still the registered one — a remount may already have replaced it. */
clearCameraPortIfCurrent(port: MaplibreCameraPort): void;
activateMaplibre(): void;
deactivateMaplibre(): void;
get hideModeSwitchButton(): boolean;
get maplibreEnabled(): boolean;
get useMaplibreMap(): boolean;
get showMaplibre(): boolean;
get isMap3d(): boolean;
private getInitialViewMode;
}
//# sourceMappingURL=MaplibreStore.d.ts.map