Reload map when style setting changed (close #1)

This commit is contained in:
Skylar Ittner 2019-09-11 19:29:20 -06:00
parent 57da01c03c
commit 46da8239b4
2 changed files with 11 additions and 6 deletions

View File

@ -16,12 +16,16 @@ function createMap() {
* @returns {undefined}
*/
function reloadMap() {
if (map != null) {
map.off();
map.remove();
map = null;
try {
if (map != null && typeof map != 'undefined') {
map.off();
map.remove();
map = null;
}
createMap();
} catch (ex) {
// oh well ¯\(°_o)/¯
}
createMap();
}
/**

View File

@ -145,7 +145,8 @@ function pickMapSource() {
return;
}
localStorage.setItem("mapsource", mapsource);
// Re-init map to load new style
reloadMap();
}
}).open();
}