aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcardus <asklocation.net@gmail.com>2023-07-30 02:22:51 +0100
committerjcardus <asklocation.net@gmail.com>2023-07-30 02:22:51 +0100
commitb2ca4606ef22eb6980a079b034bfb8f16052e05b (patch)
tree95f04ac7c250696b61cfbbae2de9aa04420b085f
parent33a1c71cd89faa6a59aeefb37d8caeb5650767f3 (diff)
downloadtrackermap-web-b2ca4606ef22eb6980a079b034bfb8f16052e05b.tar.gz
trackermap-web-b2ca4606ef22eb6980a079b034bfb8f16052e05b.tar.bz2
trackermap-web-b2ca4606ef22eb6980a079b034bfb8f16052e05b.zip
remove both sources
-rw-r--r--modern/src/map/MapPositions.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index 68073fab..600a6373 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -172,6 +172,10 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
map.off('click', clusters, onClusterClick);
map.off('click', onMapClick);
+ if (map.getLayer(clusters)) {
+ map.removeLayer(clusters);
+ }
+
[id, selected].forEach((id) => {
if (map.getLayer(id)) {
map.removeLayer(id);
@@ -179,13 +183,10 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF
if (map.getLayer(`direction-${id}`)) {
map.removeLayer(`direction-${id}`);
}
+ if (map.getSource(id)) {
+ map.removeSource(id);
+ }
});
- if (map.getLayer(clusters)) {
- map.removeLayer(clusters);
- }
- if (map.getSource(id)) {
- map.removeSource(id);
- }
};
}, [mapCluster, clusters, onMarkerClick, onClusterClick]);