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}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
function reloadMap() {
|
function reloadMap() {
|
||||||
if (map != null) {
|
try {
|
||||||
map.off();
|
if (map != null && typeof map != 'undefined') {
|
||||||
map.remove();
|
map.off();
|
||||||
map = null;
|
map.remove();
|
||||||
|
map = null;
|
||||||
|
}
|
||||||
|
createMap();
|
||||||
|
} catch (ex) {
|
||||||
|
// oh well ¯\(°_o)/¯
|
||||||
}
|
}
|
||||||
createMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,7 +145,8 @@ function pickMapSource() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localStorage.setItem("mapsource", mapsource);
|
localStorage.setItem("mapsource", mapsource);
|
||||||
|
// Re-init map to load new style
|
||||||
|
reloadMap();
|
||||||
}
|
}
|
||||||
}).open();
|
}).open();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user