aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/map/MapPositions.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index e47f945c..751c61b9 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -140,6 +140,10 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
'icon-rotation-alignment': 'map',
},
});
+
+ map.on('mouseenter', source, onMouseEnter);
+ map.on('mouseleave', source, onMouseLeave);
+ map.on('click', source, onMarkerClick);
});
map.addLayer({
id: clusters,
@@ -155,20 +159,14 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
},
});
- map.on('mouseenter', id, onMouseEnter);
- map.on('mouseleave', id, onMouseLeave);
map.on('mouseenter', clusters, onMouseEnter);
map.on('mouseleave', clusters, onMouseLeave);
- map.on('click', id, onMarkerClick);
map.on('click', clusters, onClusterClick);
map.on('click', onMapClick);
return () => {
- map.off('mouseenter', id, onMouseEnter);
- map.off('mouseleave', id, onMouseLeave);
map.off('mouseenter', clusters, onMouseEnter);
map.off('mouseleave', clusters, onMouseLeave);
- map.off('click', id, onMarkerClick);
map.off('click', clusters, onClusterClick);
map.off('click', onMapClick);
@@ -177,6 +175,10 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
}
[id, selected].forEach((source) => {
+ map.off('mouseenter', source, onMouseEnter);
+ map.off('mouseleave', source, onMouseLeave);
+ map.off('click', source, onMarkerClick);
+
if (map.getLayer(source)) {
map.removeLayer(source);
}