Reload map when style setting changed (close #1)
This commit is contained in:
parent
57da01c03c
commit
46da8239b4
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,7 +145,8 @@ function pickMapSource() {
|
||||
return;
|
||||
}
|
||||
localStorage.setItem("mapsource", mapsource);
|
||||
|
||||
// Re-init map to load new style
|
||||
reloadMap();
|
||||
}
|
||||
}).open();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user