From 27260db773a9c9748c2273b4624d0dc320a079f5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 1 Aug 2022 08:13:49 -0700 Subject: Simplify the code --- modern/src/map/switcher/switcher.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'modern/src') diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js index ee0f41ed..b6c62a6e 100644 --- a/modern/src/map/switcher/switcher.js +++ b/modern/src/map/switcher/switcher.js @@ -15,10 +15,6 @@ export class SwitcherControl { return 'top-right'; } - getStyle(id) { - return this.styles.find((it) => it.id === id); - } - updateStyles(updatedStyles, defaultStyle) { this.styles = updatedStyles; @@ -67,7 +63,7 @@ export class SwitcherControl { onSelectStyle(target) { this.onBeforeSwitch(); - const style = this.getStyle(target.dataset.id); + const style = this.styles.find((it) => it.id === target.dataset.id); this.map.setStyle(style.style, { diff: false }); this.map.setTransformRequest(style.transformRequest); -- cgit v1.2.3