Skip to content

spatial-monorepo


spatial-monorepo / core/src / SpatialMapProps

Interface: SpatialMapProps

Defined in: packages/core/src/SpatialMap.tsx:152

Properties

activeBuildingId?

optional activeBuildingId?: string

Defined in: packages/core/src/SpatialMap.tsx:156

Sets buildingSlice.activeBuilding; synced on every change.


attributionControl?

optional attributionControl?: boolean

Defined in: packages/core/src/SpatialMap.tsx:207

Show/hide the default MapLibre attribution control. Passed directly to the MapLibre constructor. Default: true.


basemapStyle?

optional basemapStyle?: string

Defined in: packages/core/src/SpatialMap.tsx:225

When this prop changes, map.setStyle(basemapStyle) is called. After MapLibre emits 'style.load', any registered IMDF layers are re-added via rehydrateImdfLayers (see Issue #128).


buildings

buildings: BuildingFeature[]

Defined in: packages/core/src/SpatialMap.tsx:154

Buildings to display; synced into buildingSlice on every change.


children?

optional children?: ReactNode

Defined in: packages/core/src/SpatialMap.tsx:217


className?

optional className?: string

Defined in: packages/core/src/SpatialMap.tsx:214

CSS class applied to the map container div.


cooperativeGestures?

optional cooperativeGestures?: boolean

Defined in: packages/core/src/SpatialMap.tsx:202

Enable cooperative gestures (two-finger pan on touch devices). Passed directly to the MapLibre constructor. Default: false.


floorUnloadIdleMs?

optional floorUnloadIdleMs?: number

Defined in: packages/core/src/SpatialMap.tsx:237

Issue #161 — Off-screen floor GeoJSON source unload idle timeout (ms).

Floors that are not currently visible have their MapLibre GeoJSON sources and layers removed after this many milliseconds of inactivity, reducing GPU memory pressure. When the user switches back to an unloaded floor its sources and layers are transparently re-added before the first paint.

Set to 0 or undefined to disable automatic unloading. Default: 30 000 (30 seconds).


initialViewState?

optional initialViewState?: ViewState

Defined in: packages/core/src/SpatialMap.tsx:187

Uncontrolled initial view state — passed to MapLibre constructor as center/zoom/pitch/bearing. Only used at mount; ignored on subsequent renders.


kioskMode?

optional kioskMode?: object

Defined in: packages/core/src/SpatialMap.tsx:244

Issue #304 — Kiosk/directory mode (F58).

Auto-resets floor + camera after inactivity. Hides zoom controls and optionally runs an attract camera loop while idle.

attractLoop?

optional attractLoop?: boolean

homeCameraPlacement?

optional homeCameraPlacement?: CameraPlacement

homeFloor?

optional homeFloor?: number

resetAfterMs?

optional resetAfterMs?: number


mapStyle?

optional mapStyle?: string | StyleSpecification

Defined in: packages/core/src/SpatialMap.tsx:163

MapLibre style URL or style spec object. When omitted a bundled Protomaps light style object is used (no network request for the style).


maxPitch?

optional maxPitch?: number

Defined in: packages/core/src/SpatialMap.tsx:212

Maximum pitch in degrees allowed for the map. Passed directly to the MapLibre constructor. Default: 70.


mode?

optional mode?: "2d" | "3d"

Defined in: packages/core/src/SpatialMap.tsx:168

Map dimensionality mode. '2d' sets pitch to 0°; '3d' sets pitch to 50°. Transitions are animated with a 600 ms map.easeTo call.


onActiveBuildingChange?

optional onActiveBuildingChange?: (id) => void

Defined in: packages/core/src/SpatialMap.tsx:158

Called when DynamicFocus changes the active building (id).

Parameters

id

string

Returns

void


onLoad?

optional onLoad?: (map) => void

Defined in: packages/core/src/SpatialMap.tsx:182

Called once when MapLibre fires its 'load' event.

Parameters

map

Map$1

Returns

void


onModeChange?

optional onModeChange?: (m) => void

Defined in: packages/core/src/SpatialMap.tsx:180

Called when the mode changes as a result of an internally-initiated action (e.g. a built-in toggle control), never as an echo of the mode prop itself changing. Use this to keep external state in sync with mode changes SpatialMap did not receive via props.

Issue #462 — setting the mode prop no longer re-invokes this callback; it previously fired for every prop change, including ones that originated from the parent itself, risking feedback loops in naive controlled-component setups.

Parameters

m

"2d" | "3d"

Returns

void


onViewStateChange?

optional onViewStateChange?: (vs) => void

Defined in: packages/core/src/SpatialMap.tsx:197

Fired on every map 'move' event with the current view state. Use alongside viewState for controlled mode.

Parameters

vs

ViewState

Returns

void


preserveDrawingBuffer?

optional preserveDrawingBuffer?: boolean

Defined in: packages/core/src/SpatialMap.tsx:268

Issue #429 — Passed directly to the MapLibre GL WebGL context.

MapLibre defaults to preserveDrawingBuffer: false, which means the drawing buffer may be cleared as soon as it has been composited to the screen — reading map.getCanvas() (via toDataURL/toBlob) at an arbitrary time outside the render loop can then return a blank/black image. SpatialCore's own export helpers (exportToPNG, exportToSVG, exportToPDF, captureMapScreenshot) work around this automatically by capturing inside a map.once('render', ...) callback after map.triggerRepaint(), so most consumers do not need this prop.

Set this to true only if you need to read the canvas synchronously yourself (bypassing SpatialCore's export helpers) — note this retains the WebGL drawing buffer for the lifetime of the map, which has a (usually small) memory/perf cost. Passed directly to the MapLibre constructor; cannot be changed after mount. Default: false.


renderOptions?

optional renderOptions?: RenderOptions

Defined in: packages/core/src/SpatialMap.tsx:219

Controls per-layer-group visibility and render properties.


style?

optional style?: CSSProperties

Defined in: packages/core/src/SpatialMap.tsx:216

Inline styles applied to the map container div (merged with defaults).


viewState?

optional viewState?: ViewState

Defined in: packages/core/src/SpatialMap.tsx:192

Controlled view state — when this prop changes, map.jumpTo() is called. Pair with onViewStateChange to implement two-way binding.

Released under commercial licensing.