diff options
Diffstat (limited to 'modern/src/map/switcher')
-rw-r--r-- | modern/src/map/switcher/switcher.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js index 742ff8c3..60a5eff7 100644 --- a/modern/src/map/switcher/switcher.js +++ b/modern/src/map/switcher/switcher.js @@ -13,9 +13,11 @@ export class SwitcherControl { return 'top-right'; } - updateStyles(updatedStyles, selectedStyle) { + updateStyles(updatedStyles, defaultStyle) { this.styles = updatedStyles; + const selectedStyle = this.currentStyle || defaultStyle; + while (this.mapStyleContainer.firstChild) { this.mapStyleContainer.removeChild(this.mapStyleContainer.firstChild); } @@ -65,6 +67,8 @@ export class SwitcherControl { } target.classList.add('active'); + this.currentStyle = target.dataset.id; + this.onAfterSwitch(); } |