Register an event

3D map can trigger some events. You can observe these events by calling registerEventmethod.

FnoMapManager.registerEvent("mouseClickContainer", (data) => {
console.log("Container clicked:", data)
});

The best place to register an event is in the loaded callback function.

Example

For the "mouseClickContainer", the event trigger when user click on a 3d container:

const fnoToken = "<YOUR-FNO-TOKEN>"; // provided by the backoffice
const fnoMapId = "<MAP-ID>" // id of the map to load
let FnoMapManager;

window.addEventListener("load", function(){
FnoMapManager = window.FnoMapManager;
FnoMapManager.initViewerMode(fnoToken)
FnoMapManager.loadMap(idMap, '3dMapContainer', function(){
FnoMapManager.registerEvent("mouseClickContainer", (data) => {
// user clicked on a container in the 3d map
console.log("Container clicked:", data)
});
})
});

All events are located in Events from unity section