JMap.Map.Interaction

We introduced a notion of map interactor in JMap.

The need is that we want the map to interact in different ways depending on what the user is doing :

  • When he is drawing on the map we display shape on the map
  • When he is clicking on the map we display a popup information
  • etc...

So we defined our own map interactors for JMap, and we also allow you to create and register your own interactors.

An interactor is a JS object that define 4 functions (for more details consult interface JMapInteractor) :

 - init(map: maplibregl.Map): void
- activate(): void
- deactivate(): void
- terminate(): void

After creating your interactor object, you need to add it through the interaction service :

 JMap.Map.Interaction.addInteractor(
"display-bubbles-on-click", // interactor id
bubbleInteractor, // interactor object
true // if true activate the interactor after being added
)

There is always an interactor actived, and this is the active interactions that are in use on the map.

When you activate an interactor, the previous one is deactivated, and the new one activated on the map.

When you don't need anymore an interactor you can terminate it, and it will not exist anymore in the JMap Cloud NG Core library.

Index

Functions