aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-13 18:02:30 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-13 18:02:30 -0700
commit5b1d69ef52e9200c35bf8986c265a42be7cf23cf (patch)
tree48f47630616ac6c7f6c5937d19d3abca848220f3
parentf3024c900dffe7668b294054ee9a0345696769db (diff)
downloadtrackermap-web-5b1d69ef52e9200c35bf8986c265a42be7cf23cf.tar.gz
trackermap-web-5b1d69ef52e9200c35bf8986c265a42be7cf23cf.tar.bz2
trackermap-web-5b1d69ef52e9200c35bf8986c265a42be7cf23cf.zip
Clear popups on switch
-rw-r--r--modern/src/mapManager.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/modern/src/mapManager.js b/modern/src/mapManager.js
index 7c7e2929..c597eb58 100644
--- a/modern/src/mapManager.js
+++ b/modern/src/mapManager.js
@@ -86,6 +86,11 @@ const addLayer = (id, source, icon, text, onClick) => {
}
const removeLayer = (id, source) => {
+ const popups = element.getElementsByClassName('mapboxgl-popup');
+ if (popups.length) {
+ popups[0].remove();
+ }
+
map.off('click', id, layerClickCallbacks[id]);
delete layerClickCallbacks[id];