@osimatic/helpers-js 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/open_street_map.js +14 -5
- package/package.json +1 -1
package/open_street_map.js
CHANGED
|
@@ -21,22 +21,31 @@ class OpenStreetMap {
|
|
|
21
21
|
this.markers = [];
|
|
22
22
|
this.locations = [];
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
this.map = OpenStreetMap.createMap(mapContainer, options);
|
|
25
|
+
if (null === this.map) {
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
this.centerOnFrance();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static createMap(mapContainer, options) {
|
|
33
|
+
if (!mapContainer.length) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
28
37
|
const container = L.DomUtil.get(mapContainer[0]);
|
|
29
38
|
if (container != null) {
|
|
30
39
|
container._leaflet_id = null;
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
const map = L.map(mapContainer[0], options || {});
|
|
34
43
|
|
|
35
44
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
36
|
-
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>
|
|
37
|
-
}).addTo(
|
|
45
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
|
46
|
+
}).addTo(map);
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
return map;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
static getUrl(latitude, longitude) {
|