aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/map/switcher/switcher.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js
index 60a5eff7..d96f7ffc 100644
--- a/modern/src/map/switcher/switcher.js
+++ b/modern/src/map/switcher/switcher.js
@@ -16,7 +16,16 @@ export class SwitcherControl {
updateStyles(updatedStyles, defaultStyle) {
this.styles = updatedStyles;
- const selectedStyle = this.currentStyle || defaultStyle;
+ let selectedStyle = null;
+ for (const style of this.styles) {
+ if (style.id === (this.currentStyle || defaultStyle)) {
+ selectedStyle = style.id;
+ break;
+ }
+ }
+ if (!selectedStyle) {
+ this.styles[0].id;
+ }
while (this.mapStyleContainer.firstChild) {
this.mapStyleContainer.removeChild(this.mapStyleContainer.firstChild);