Commit 05b8b86ce64fcc1ac2fdba4c2c6297a0ce871273
1 parent
8f54146c
small refactoring according to new HERE map
Showing
2 changed files
with
6 additions
and
5 deletions
... | ... | @@ -78,10 +78,10 @@ export default class TbMapWidgetV2 { |
78 | 78 | tbMap.tooltipActionsMap[descriptor.name] = descriptor; |
79 | 79 | }); |
80 | 80 | |
81 | + let openStreetMapProvider = {}; | |
81 | 82 | if (mapProvider === 'google-map') { |
82 | 83 | this.map = new TbGoogleMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.gmApiKey, settings.gmDefaultMapType); |
83 | 84 | } else if (mapProvider === 'openstreet-map') { |
84 | - let openStreetMapProvider = {}; | |
85 | 85 | if (settings.useCustomProvider && settings.customProviderTileUrl) { |
86 | 86 | openStreetMapProvider.name = settings.customProviderTileUrl; |
87 | 87 | openStreetMapProvider.isCustom = true; |
... | ... | @@ -90,7 +90,8 @@ export default class TbMapWidgetV2 { |
90 | 90 | } |
91 | 91 | this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, openStreetMapProvider); |
92 | 92 | } else if (mapProvider === 'here') { |
93 | - this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.mapProvider, settings.credentials); | |
93 | + openStreetMapProvider.name = settings.mapProvider; | |
94 | + this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, openStreetMapProvider, settings.credentials); | |
94 | 95 | } else if (mapProvider === 'image-map') { |
95 | 96 | this.map = new TbImageMap(this.ctx, $element, this.utils, initCallback, |
96 | 97 | settings.mapImageUrl, | ... | ... |
... | ... | @@ -33,17 +33,17 @@ export default class TbOpenStreetMap { |
33 | 33 | }; |
34 | 34 | } |
35 | 35 | |
36 | - if (mapProvider.startsWith("HERE.")) { | |
36 | + if (mapProvider.name.startsWith("HERE.")) { | |
37 | 37 | credentials.app_id = credentials.app_id || "AhM6TzD9ThyK78CT3ptx"; |
38 | 38 | credentials.app_code = credentials.app_code || "p6NPiITB3Vv0GMUFnkLOOg"; |
39 | 39 | } |
40 | 40 | |
41 | + this.map = L.map($containerElement[0]).setView([0, 0], this.defaultZoomLevel || 8); | |
42 | + | |
41 | 43 | if (disableScrollZooming) { |
42 | 44 | this.map.scrollWheelZoom.disable(); |
43 | 45 | } |
44 | 46 | |
45 | - this.map = L.map($containerElement[0]).setView([0, 0], this.defaultZoomLevel || 8); | |
46 | - | |
47 | 47 | var tileLayer = mapProvider.isCustom ? L.tileLayer(mapProvider.name) : L.tileLayer.provider(mapProvider.name, credentials); |
48 | 48 | tileLayer.addTo(this.map); |
49 | 49 | ... | ... |