JMap.Event.MouseOver.on.afterContentProcessed
This event is triggered when the map has been clicked, after the mouseover content has been calculated.
Your listener id (must be unique for all mouseover events)
Your listener function
JMap.Event.MouseOver.on.beforeContentProcessed
This event is triggered each time the map is clicked, and before the mouseover content is calculated or popup opened.
This event is a special on, as it offers 3 methods which can change the mouseover behavior:
You can test the event function addFeaturesToLayerSelection, by pasting the following code in the console (adapt for your configuration):
JMap.Event.MouseOver.on.beforeContentProcessed(
"my-listener",
params => {
console.log("Mouseover selection before", params.selection[4])
params.addFeaturesToLayerSelection(4, [{
id: 58,
properties: {JMAP_FID: 58, NOM_QR: "Bois-Francs"},
type: "Feature",
geometry: {coordinates: [],type: "Polygon"}
}])
console.log("Mouseover selection after", params.selection[4])
}
)
This listener adds a feature on every click on the map, so no matter where you click, the mouseover will contains at least one feature (the one dynamically added by the listener)
Then paste this in the console to remove the previous listener:
JMap.Event.MouseOver.remove(“my-listener“)
You can test that now no mouseover is displayed anymore when we click on an empty area.
Finally you can test the event function removeFeaturesFromLayerSelection by pasting the following code snippet:
JMap.Event.MouseOver.on.beforeContentProcessed(
"my-listener",
params => {
console.log("Mouseover selection before", params.selection[4])
params.removeFeaturesFromLayerSelection(4, [58])
console.log("Mouseover selection after", params.selection[4])
}
)
Now you can click on the feature id=58, but no mouseover will display for if, as it is automatically removed by the listener.
Your listener id (must be unique for all mouseover events)
Your listener function
JMap.Event.MouseOver.on.popupClosed
This event is triggered when the popup has been closed.
Your listener id (must be unique for all mouseover events)
Your listener function
JMap.Event.MouseOver.on.popupOpened
This event is triggered when the popup has been opened.
Your listener id (must be unique for all mouseover events)
Your listener function
JMap.Event.MouseOver.on
Here you have all available user events on which you can attach a listener.