Events
You can subscribe to a variery of events that the wayfinder can generate allowing you to fully integrate with its actions.
The Wayfinder class exposes the usual addEventListener, and removeEventListener so that you can subscribe to events at the ‘root’ level. The defined events are as follows:
|
Event Name |
Description |
Event.detail |
|
“boundschanged” |
Dispatched whenever the minimum and maximum coordinates for the map changes. Usually triggered during load. |
|
|
“error” |
Dispatched when map loading fails for whatever reason |
error message |
|
“floorchange” |
Dispatched when the floor is about to change, during, and after it has changed |
status: ‘changing’,’loading’,’error’, ‘animating’, ‘changed’ id: floorId error: error message or object (if error) |
|
“floorload” |
Dispatched in response to floor loading operations |
status: ‘error’, ‘ready’, ‘loading’ id: floorId error: error message or object (if error) |
|
“loading” |
Dispatched when map loading starts, for example as a result to the call to loadFromApiKey |
|
|
“loaded” |
Dispatched when the first floor (the one initially shown) has loaded and is now visible. All API commands are now available from this point. |
|
|
“ready” |
Dispatched when everything has finished background-loading (all floors, icons and graphics) |
|
|
“render” |
Dispatched each time the map is updated/redrawn (even panning the map will trigger this) |
timestamp in milliseconds |
|
“resize” |
Dispatched when the Wayfinder DIV element resizes |
{width, height} |
|
“mousedown” ”mousemove” ”mouseup” ”mousewheel” |
Triggered when the mouse goes down, moved, lifted up or wheeled on the map |
screen: {x,y}, obj: {x,y,z}, (added in 2.11.0) amenity: null | amenity, destination: null | destination, destinationLabel: null | destination, transit: null | transit, transitPopup: null | see below, marker: null | marker, button: false/true, wheel: null/delta, meshes: [] - See below, floor: null | number (Floor ID) modifiers: { ctrlKey: boolean, altKey: boolean, shiftKey: boolean } (added in 2.12.0) |
|
“routecleared” |
The route line (if any) has been cleared from the map |
|
|
“routedrawn” |
A route line has been drawn on the map between two points |
status: Route information waypoints: array of waypoints information, split by floor |
|
“routefailed” |
Route generation request failed |
Error information |
|
"mapapp" |
A special "map has loaded" event generated when visiting the map app page and using the special loadAsMapApp function |
You must trigger the routing between the start and end positions, and popup information about the destination or amenity.
unitId: kiosk id this was sent from ddaMode: if kiosk was in accessible mode startNodeId: id of the starting node startNode: null | node endNodeId: id of the ending node endNode: null | node destinationId: id of the target destination destination: null | destination amenityId: id of the target amenity amenity: null | amenity kioskSessionId: An id the kiosk passed to track a session |
|
"locationupdated" |
When location services are enabled, this event will be emitted every time the location is updated |
timestamp: milliseconds timestamp of the location update inBounds: boolean indicating if the point is within the map bounds mapPoint: null or X,Y coordinates of the location on the map gpsPosition: null or GeolocationCoordinates of the location |
Meshes Array
The meshes array is directly from THREE.js. Its an array of objects containing, in depth order the meshes passed through. See THREE.JS Raycaster.intersectObject for more details.
transitPopup:
Contains the following inside the "detail"
|
Event Name |
Description |
Event.detail |
|
follow() |
function |
Call to navigate to the next part of the route. This will switch maps if needed and pan/center on the next "leg" of the route |
|
hide() |
function |
Hides the transit popup |
|
leg |
number |
If the route is split between several maps, this indicates which "leg" of the journey it is |
|
node |
class |
a WayfinderNode where this is positioned |
|
panToView |
function |
Centers the display on this popup |
|
show |
function |
re-displays the prompt if hidden with hide() |
|
targetMapId |
number |
ID of the map this will jump to |
|
text |
string |
The text that is displayed in the prompt |
|
travelType |
function |
the WayfinderTravelType used for this |