Map tileset toogle keeps old markers and doesnt recenter map
This commit is contained in:
@@ -319,7 +319,7 @@
|
||||
}
|
||||
|
||||
console.log("renderMap");
|
||||
renderMap();
|
||||
renderMap(true);
|
||||
}
|
||||
|
||||
function refreshMap() {
|
||||
@@ -332,11 +332,13 @@
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function renderMap() {
|
||||
function renderMap(tilesetChangeOnly = false) {
|
||||
if(preorderMap) {
|
||||
markers.forEach(function(m) {
|
||||
preorderMap.removeLayer(m);
|
||||
});
|
||||
if(!tilesetChangeOnly) {
|
||||
markers.forEach(function(m) {
|
||||
preorderMap.removeLayer(m);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
preorderMap = L.map('preorder-map').setView([<?=TT_PLACEHOLDER_GPS_LAT?>, <?=TT_PLACEHOLDER_GPS_LONG?>], 12);
|
||||
}
|
||||
@@ -352,8 +354,10 @@
|
||||
}).addTo(preorderMap);
|
||||
|
||||
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
|
||||
|
||||
addMarkers();
|
||||
|
||||
if(!tilesetChangeOnly) {
|
||||
addMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user