@expofp/floorplan
Version:
Interactive floor plan library for expos and events
29 lines • 1.59 kB
TypeScript
/** The slice of a `Layer` this helper needs: an observable `visible` flag. */
export interface RevealableLayer {
readonly visible: boolean;
}
export interface RevealLayerArgs<L extends RevealableLayer> {
/** The floor the target sits on; `null`/`undefined` when the plan has no floors or the floor is unknown. */
readonly layer: L | null | undefined;
/** Switches the floor on (`LayerStore.updateVisibility(layer, true)`); its effect lands asynchronously. */
readonly show: (layer: L) => void;
/** The camera move to run once the floor is on screen. */
readonly then: () => void;
}
/**
* Brings a target's floor on screen, then runs the camera move.
*
* - no floor, or floor already visible → the move runs right away;
* - otherwise the floor is switched on and the move waits for `visible` to
* actually flip — `LayerStore.updateVisibility` resolves that after the layer
* payload loads, so a move issued synchronously would either frame the old
* floor (legacy renderer) or be superseded by the floor-change fit the
* MapLibre adapter performs when the visible floor changes
* (`useLayerVisibilitySync`). Deferring the move behind the same `visible`
* flip makes it the *last* camera command of that change, so it wins.
*
* Returns a disposer for the pending wait (no-op once the move has run) —
* callers cancel a previous reveal before starting a new one.
*/
export declare function revealLayer<L extends RevealableLayer>({ layer, show, then, }: RevealLayerArgs<L>): () => void;
//# sourceMappingURL=reveal-layer.d.ts.map