JMap.Map.Interaction.activateInteractorById
Activate an existing map interactor.
Deactivate the previous one, and activate the new one.
The interactor id to activate
JMap.Map.Interaction.addInteractor
Add a map interactor.
If the id has already an existing interactor defined for, it will replace the old one.
So be carrefull not to remove JMap interactors.
You can get the list of already existing interactor ids like this :
JMap.Map.Interaction
.getAllInteractorDescriptors()
.map(interactor => interactor.id)
The new interactor id.
The map interactor object
If true will activate the new interactor after being added
JMap.Map.Interaction.getActiveInteractorId
Returns the active interactor id.
JMap.Map.Interaction.getAllInteractorIds
Returns all existing interactor ids.
JMap.Map.Interaction.terminateInteractorById
Terminate the map interactor.
After being terminated, the interactor doesn't exist anymore in JMap NG Core library.
You cannot activate it anymore.
The interactor id to terminate
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 :
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: mapboxgl.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 NG Core library.