diff options
author | Anton Tananaev <anton@traccar.org> | 2022-08-01 08:10:53 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-08-01 08:10:53 -0700 |
commit | eeaa67a1fcafb2a95bea450035504726b9481838 (patch) | |
tree | 1b6a8710263182ce6696fa6f54284fe1e77771e2 /modern/src/map/switcher/switcher.js | |
parent | 26fd9c7f4a4280e4f906f79fb779fb9c73483adf (diff) | |
download | trackermap-web-eeaa67a1fcafb2a95bea450035504726b9481838.tar.gz trackermap-web-eeaa67a1fcafb2a95bea450035504726b9481838.tar.bz2 trackermap-web-eeaa67a1fcafb2a95bea450035504726b9481838.zip |
Fix ordnance survey map
Diffstat (limited to 'modern/src/map/switcher/switcher.js')
-rw-r--r-- | modern/src/map/switcher/switcher.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js index 8fe48929..ee0f41ed 100644 --- a/modern/src/map/switcher/switcher.js +++ b/modern/src/map/switcher/switcher.js @@ -15,6 +15,10 @@ export class SwitcherControl { return 'top-right'; } + getStyle(id) { + return this.styles.find((it) => it.id === id); + } + updateStyles(updatedStyles, defaultStyle) { this.styles = updatedStyles; @@ -63,9 +67,9 @@ export class SwitcherControl { onSelectStyle(target) { this.onBeforeSwitch(); - this.map.setStyle(JSON.parse(target.dataset.style), { - diff: false, - }); + const style = this.getStyle(target.dataset.id); + this.map.setStyle(style.style, { diff: false }); + this.map.setTransformRequest(style.transformRequest); this.onSwitch(target.dataset.id); |