aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-08-01 08:13:49 -0700
committerAnton Tananaev <anton@traccar.org>2022-08-01 08:13:49 -0700
commit27260db773a9c9748c2273b4624d0dc320a079f5 (patch)
tree00325f8684f3d13fcc25e8e2509ab96d266588ae
parenteeaa67a1fcafb2a95bea450035504726b9481838 (diff)
downloadtrackermap-web-27260db773a9c9748c2273b4624d0dc320a079f5.tar.gz
trackermap-web-27260db773a9c9748c2273b4624d0dc320a079f5.tar.bz2
trackermap-web-27260db773a9c9748c2273b4624d0dc320a079f5.zip
Simplify the code
-rw-r--r--modern/src/map/switcher/switcher.js6
1 files changed, 1 insertions, 5 deletions
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);