Selection
Selection is what the map treats as the visitor's current focus. Selecting something opens the map's detail panel for it, switches to the right floor, and frames the camera on it.
ucba, a publicly available campus with the building muntz-hall and the room 170. Substitute your own campus slug once you have one. Slugs for your campus are listed in your Waylocate console, and the addressing rules are in the reference grammar.Commands
await map.selection.setBuilding("muntz-hall");
await map.selection.setBuilding("muntz-hall", { floor: "2" });
await map.selection.setFloor("muntz-hall/floor/2");
await map.selection.setRoom("muntz-hall/170");
await map.selection.clear();
| Method | Argument | Effect |
|---|---|---|
setBuilding(ref, options?) | Building reference, optional { floor } | Selects the building, optionally opening a specific floor |
setFloor(ref) | Floor reference | Switches the active floor |
setRoom(ref) | Room reference | Selects the room and switches to its floor |
clear() | none | Dismisses the current selection and its detail panel |
Each resolves once the map has applied the change. An unresolvable reference
rejects with REF_NOT_FOUND.
References
Selection commands take references, not names and not identifiers.
| Form | Example |
|---|---|
| Building | muntz-hall |
| Floor | muntz-hall/floor/2 |
| Room | muntz-hall/170 |
A room reference is qualified by its building because room slugs are only unique within one. When the map reports a selection back to you it gives the room bare, relative to the building in the same payload, so reassemble the two if you plan to send the value back.
map.on("selection.changed", ({ building, room }) => {
if (building && room) {
const ref = `${building}/${room}`;
}
});
The React room prop accepts either spelling and normalises internally.
The complete grammar, including here and pin: coordinates, is in the
reference grammar.
Selection and the camera are separate
Selecting a room frames it, but framing a room does not select it.
await map.camera.fitTo("muntz-hall"); // moves the viewport, changes nothing else
await map.selection.setBuilding("muntz-hall"); // selects, and framing follows
The separation exists so that a host rendering its own detail interface can
suppress the map's panel with the panel chrome flag, drive framing itself, and
never trigger the map's own selection behaviour. A host that wants the map's
built-in behaviour uses selection and lets the framing follow.
Reacting to selection
selection.changed fires for every change, whether the visitor caused it or you
did. Filter on meta.source to react only to the visitor.
map.on("selection.changed", (selection, meta) => {
if (meta.source !== "user") return;
showAvailability(selection.building, selection.room);
});
The payload is { building, floor, room }, each a string or null.