aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/map/Map.js11
-rw-r--r--modern/src/map/switcher/switcher.js4
2 files changed, 8 insertions, 7 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js
index 71fb5e56..2bcf04f4 100644
--- a/modern/src/map/Map.js
+++ b/modern/src/map/Map.js
@@ -20,14 +20,19 @@ export const map = new mapboxgl.Map({
let ready = false;
const readyListeners = new Set();
-const addReadyListener = listener => readyListeners.add(listener);
+const addReadyListener = listener => {
+ readyListeners.add(listener);
+ listener(ready);
+};
-const removeReadyListener = listener => readyListeners.delete(listener);
+const removeReadyListener = listener => {
+ readyListeners.delete(listener);
+};
const updateReadyValue = value => {
ready = value;
readyListeners.forEach(listener => listener(value));
-}
+};
const initMap = async () => {
const background = await loadImage('images/background.svg');
diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js
index c2b9d6d4..ff9fbe97 100644
--- a/modern/src/map/switcher/switcher.js
+++ b/modern/src/map/switcher/switcher.js
@@ -32,13 +32,9 @@ export class SwitcherControl {
if (srcElement.classList.contains('active')) {
return;
}
- console.log('beforeSwitch start');
this.beforeSwitch();
- console.log('beforeSwitch end');
this.map.setStyle(JSON.parse(srcElement.dataset.uri));
- console.log('afterSwitch start');
this.afterSwitch();
- console.log('afterSwitch end');
this.mapStyleContainer.style.display = 'none';
this.styleButton.style.display = 'block';
const elms = this.mapStyleContainer.getElementsByClassName('active');