Skip to content

Wayfinding & Selection UI Controls

The SDK ships five pre-built controls for wayfinding and space interaction (PRD F39–F43). All are exported from @diginestai/core and must be rendered as children of <SpatialMap>.


SpaceHighlight (F39)

Highlights one or more IMDF units with a configurable fill and stroke overlay.

tsx
import { SpatialProvider, SpatialMap, SpaceHighlight } from '@diginestai/core';

export function Demo() {
  return (
    <SpatialProvider>
      <SpatialMap buildings={[building]}>
        <SpaceHighlight
          unitIds={['unit-a1', 'unit-b3']}
          color="#2393d4"
          opacity={0.4}
          strokeColor="#086bb7"
          strokeWidth={2}
        />
      </SpatialMap>
    </SpatialProvider>
  );
}
PropTypeDefaultDescription
unitIdsstring[]requiredIMDF unit IDs to highlight
colorstringtheme primaryFill colour (hex or CSS colour)
opacitynumber0.35Fill opacity 0–1
strokeColorstringcolorOutline colour
strokeWidthnumber1Outline width in pixels

SelectionPin (F40)

Renders a floating pin at a selected space's display_point. Automatically tracks floor visibility.

tsx
import { SelectionPin } from '@diginestai/core';

<SpatialMap buildings={[building]}>
  <SelectionPin
    unitId="unit-a1"
    label="Conference Room A"
    onDismiss={() => setSelected(null)}
  />
</SpatialMap>
PropTypeDescription
unitIdstringIMDF unit ID for pin placement
labelstring?Text label shown below the pin
onDismiss() => voidCalled when user taps the dismiss button

AccessibleRouteToggle (F41)

Toggles between standard and accessibility-optimised route calculation. Pair with <WayfindingPanel>.

tsx
import { AccessibleRouteToggle } from '@diginestai/core';

<SpatialMap buildings={[building]}>
  <AccessibleRouteToggle position="bottom-right" />
</SpatialMap>

When active the wayfinding engine avoids stairs and prefers lifts and ramps.


FitControl (F42)

Fits the camera to a specific unit, floor, or building bounding box.

tsx
import { FitControl, type ControlPosition } from '@diginestai/core';

<SpatialMap buildings={[building]}>
  <FitControl position="top-right" padding={40} />
</SpatialMap>
PropTypeDefaultDescription
positionControlPosition'top-right'Corner placement
paddingnumber20Camera padding in pixels
fitTo'building' | 'floor''building'Fit scope

ShareControl (F43)

Generates and copies a deep-link URL encoding the current map state. Uses buildDeepLink internally.

tsx
import { ShareControl } from '@diginestai/core';

<SpatialMap buildings={[building]}>
  <ShareControl position="top-right" />
</SpatialMap>

On click, the control writes a URL with ?bs_floor=…&bs_lat=…&bs_lng=…&bs_zoom=… to the clipboard and shows a brief toast.


WayfindingControl (v2.16, #380)

An all-in-one component that renders draggable start and stop markers on the map canvas and draws the computed A* route as a GeoJSON line overlay. Replaces the need to wire <WayfindingPanel> + separate markers by hand.

tsx
import { SpatialProvider, SpatialMap } from '@diginestai/core';
import { WayfindingControl } from '@diginestai/ui';
import { buildGraph } from '@diginestai/wayfinding';

export function Demo({ imdfFeatures }) {
  const graph = buildGraph(imdfFeatures);

  return (
    <SpatialProvider>
      <SpatialMap buildings={[building]}>
        <WayfindingControl
          graph={graph}
          obstacles={[]}
          startLabel="You are here"
          stopLabel="Destination"
          onPathChange={(path) => console.log('route:', path)}
        />
      </SpatialMap>
    </SpatialProvider>
  );
}
PropTypeDefaultDescription
graphWayfindingGraphrequiredNavigation graph from buildGraph().
obstaclesstring[][]Unit IDs to treat as impassable during routing.
onPathChange(path: NavigationPath | null) => voidCalled on every route recalculation; null when no route exists.
startLabelstring'Start'Tooltip text on the start marker.
stopLabelstring'Stop'Tooltip text on the stop marker.

Markers are draggable. Dropping either marker triggers immediate A* recalculation. The route line is rendered at z-index 900 (wayfinding-route layer).


Combining controls

tsx
<SpatialMap buildings={[building]}>
  <SpaceHighlight unitIds={highlightedIds} color="#2393d4" />
  {selectedId && (
    <SelectionPin unitId={selectedId} label={selectedLabel} onDismiss={clear} />
  )}
  <AccessibleRouteToggle position="bottom-right" />
  <FitControl position="top-right" />
  <ShareControl position="top-right" />
</SpatialMap>

Released under commercial licensing.