@raruto/leaflet-elevation 1.8.9 → 1.9.2

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/README.md CHANGED
@@ -17,38 +17,29 @@ _For a working example see one of the following demos:_
17
17
  - [loading .geojson file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-data.html)
18
18
  - [loading .kml file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_kml-data.html)
19
19
  - [loading .tcx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_tcx-data.html)
20
- - [loading strings](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_string-data.html)
21
- - [loading geojson group](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-group.html)
22
- - [loading local .gpx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_upload-gpx.html)
20
+ - [loading a local .gpx file](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_upload-gpx.html)
21
+ - [loading multiple tracks (gpx group 1)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hoverable-tracks.html)
22
+ - [loading multiple tracks (gpx group 2)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-charts.html)
23
+ - [loading individual tracks (geojson)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-group.html)
24
+ - [loading individual tracks (gpx)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-tracks.html)
25
+ - [loading waypoint icons (gpx)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_gpx-waypoints.html)
26
+ - [loading waypoint icons (geojson)](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-waypoints.html)
23
27
 
24
28
  <br/>
25
29
 
30
+ - [autohide map](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-map.html)
31
+ - [autohide chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-chart.html)
26
32
  - [custom chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_extended-ui.html)
27
33
  - [custom colors](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
34
+ - [custom labels](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_i18n-strings.html)
35
+ - [custom marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_dynamic-runner.html)
28
36
  - [custom summary](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-summary.html)
29
- - [close button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_close-button.html)
37
+ - [leaflet button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_close-button.html)
38
+ - [leaflet almost over](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_almost-over.html)
39
+ - [leaflet follow marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_follow-marker.html)
30
40
  - [slope chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_slope-chart.html)
31
41
  - [speed chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_speed-chart.html)
32
- - [i18n strings](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_i18n-strings.html)
33
-
34
- <br/>
35
-
36
- - [hoverable chart / hidden map](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-map.html)
37
- - [hoverable chart / hidden chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-chart.html)
38
- - [hoverable tracks](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hoverable-tracks.html)
39
- - [toggable tracks](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-tracks.html)
40
- - [toggable charts](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_toggable-charts.html)
41
-
42
- <br/>
43
-
44
- - [waypoint icons / gpx](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_gpx-waypoints.html)
45
- - [waypoint icons / geojson](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-waypoints.html)
46
-
47
- <br/>
48
-
49
- - [almost over](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_almost-over.html)
50
- - [follow marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_follow-marker.html)
51
- - [dynamic runner](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_dynamic-runner.html)
42
+ - [web editor](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_string-data.html)
52
43
 
53
44
  ---
54
45
 
@@ -69,8 +60,8 @@ _For a working example see one of the following demos:_
69
60
  <style> html, body, #map, #elevation-div { height: 100%; width: 100%; padding: 0; margin: 0; } #map { height: 75%; } #elevation-div { height: 25%; font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; } </style>
70
61
 
71
62
  <!-- leaflet-ui -->
72
- <script src="https://unpkg.com/leaflet@1.3.2/dist/leaflet.js"></script>
73
- <script src="https://unpkg.com/leaflet-ui@0.2.0/dist/leaflet-ui.js"></script>
63
+ <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
64
+ <script src="https://unpkg.com/leaflet-ui@0.5.1/dist/leaflet-ui.js"></script>
74
65
 
75
66
  <!-- leaflet-elevation -->
76
67
  <link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-elevation/dist/leaflet-elevation.css" />
@@ -256,7 +247,7 @@ _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Inte
256
247
  ---
257
248
 
258
249
  **Compatibile with:**
259
- [![Leaflet 1.x compatible!](https://img.shields.io/badge/Leaflet-1.6.0-1EB300.svg?style=flat)](http://leafletjs.com/reference.html)
250
+ [![Leaflet 1.x compatible!](https://img.shields.io/badge/Leaflet-1.7.0-1EB300.svg?style=flat)](http://leafletjs.com/reference.html)
260
251
  [![d3.js v6 compatibile!](https://img.shields.io/badge/d3.js-6.5-1EB300.svg?style=flat)](https://www.npmjs.com/package/d3)
261
252
  [![@tmcw/togeojson v4.5.0 compatibile!](https://img.shields.io/badge/@tmcw/togeojson-4.5-1EB300.svg?style=flat)](https://www.npmjs.com/package/@tmcw/togeojson)
262
253
 
@@ -1766,7 +1766,7 @@
1766
1766
  wptIcons: {
1767
1767
  '': L.divIcon({
1768
1768
  className: 'elevation-waypoint-marker',
1769
- html: '<i class="elevation-waypoint-icon"></i>',
1769
+ html: '<i class="elevation-waypoint-icon default"></i>',
1770
1770
  iconSize: [30, 30],
1771
1771
  iconAnchor: [8, 30]
1772
1772
  })
@@ -1793,7 +1793,7 @@
1793
1793
  __TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.5.0/dist/togeojson.umd.js',
1794
1794
  __LGEOMUTIL: 'https://unpkg.com/leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js',
1795
1795
  __LALMOSTOVER: 'https://unpkg.com/leaflet-almostover@1.0.1/src/leaflet.almostover.js',
1796
- __LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.8.9/libs/leaflet-distance-marker.min.js',
1796
+ __LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.9.2/libs/leaflet-distance-marker.min.js',
1797
1797
 
1798
1798
  /*
1799
1799
  * Add data to the diagram either from GPX or GeoJSON and update the axis domain and data
@@ -2171,10 +2171,11 @@
2171
2171
 
2172
2172
  if ("alt" in point) point.meta.ele = point.alt; // "coordinateProperties" property is generated inside "@tmcw/toGeoJSON"
2173
2173
 
2174
- if (properties && properties.coordinateProperties) {
2175
- var props = properties.coordinateProperties;
2176
- if ("times" in props) point.meta.time = new Date(Date.parse(props.times[i]));
2177
- if ("heart" in props) point.meta.hr = parseInt(props.heart[i]); // TODO: ask to "@tmcw/toGeoJSON" for "cadence" and "temperature" implementation
2174
+ var props = properties && properties.coordinateProperties || properties;
2175
+
2176
+ if (props) {
2177
+ if ("coordTimes" in props) point.meta.time = new Date(Date.parse(props.coordTimes[i]));else if ("times" in props) point.meta.time = new Date(Date.parse(props.times[i]));else if ("time" in props) point.meta.time = new Date(Date.parse(_typeof(props.time) === 'object' ? props.time[i] : props.time));
2178
+ if ("heartRates" in props) point.meta.hr = parseInt(props.heartRates[i]);else if ("heartRate" in props) point.meta.hr = parseInt(_typeof(props.heartRate) === 'object' ? props.heartRate[i] : props.heartRate);else if ("heart" in props) point.meta.hr = parseInt(_typeof(props.heart) === 'object' ? props.heart[i] : props.heart); // TODO: ask to "@tmcw/toGeoJSON" for "cadence" and "temperature" implementation
2178
2179
  }
2179
2180
 
2180
2181
  _this6._addPoint((_point$lat = point.lat) !== null && _point$lat !== void 0 ? _point$lat : point[1], (_point$lng = point.lng) !== null && _point$lng !== void 0 ? _point$lng : point[0], (_ref = (_point$alt = point.alt) !== null && _point$alt !== void 0 ? _point$alt : point.meta.ele) !== null && _ref !== void 0 ? _ref : point[2]);
@@ -2224,23 +2225,6 @@
2224
2225
  _addMarker: function _addMarker(marker) {
2225
2226
  if (marker) this._markers.addLayer(marker);
2226
2227
  },
2227
- _bindPopup: function _bindPopup(marker) {
2228
- var popup = marker._popup;
2229
-
2230
- if (popup) {
2231
- popup.options.className = 'elevation-popup';
2232
-
2233
- if (popup._content) {
2234
- popup._content = decodeURI(popup._content);
2235
- popup.bindTooltip(popup._content, {
2236
- direction: 'auto',
2237
- sticky: true,
2238
- opacity: 1,
2239
- className: 'elevation-tooltip'
2240
- }).openTooltip();
2241
- }
2242
- }
2243
- },
2244
2228
 
2245
2229
  /**
2246
2230
  * Initialize "L.AlmostOver" integration
@@ -2615,13 +2599,21 @@
2615
2599
  });
2616
2600
 
2617
2601
  if ([true, 'markers'].includes(wptLabels) && (name || desc)) {
2618
- marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
2602
+ var content = decodeURI("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : ''));
2603
+ marker.bindPopup(content, {
2604
+ className: 'elevation-popup',
2605
+ keepInView: true
2606
+ }).openPopup();
2607
+ marker.bindTooltip(content, {
2608
+ className: 'elevation-tooltip',
2609
+ direction: 'auto',
2610
+ sticky: true,
2611
+ opacity: 1
2612
+ }).openTooltip();
2619
2613
  }
2620
2614
 
2621
2615
  control._addMarker(marker);
2622
2616
 
2623
- control._bindPopup(marker);
2624
-
2625
2617
  control.fire('waypoint_added', {
2626
2618
  point: marker,
2627
2619
  element: latlng,
@@ -3112,19 +3104,20 @@
3112
3104
 
3113
3105
  select('.download a', this._summary._container).onclick = function (e) {
3114
3106
  e.preventDefault();
3107
+ var event = {
3108
+ downloadLink: _this20.options.downloadLink,
3109
+ confirm: saveFile.bind(_this20, _this20._downloadURL)
3110
+ };
3115
3111
 
3116
- if (e.downloadLink == 'modal' && typeof CustomEvent === "function") {
3112
+ if (_this20.options.downloadLink == 'modal' && typeof CustomEvent === "function") {
3117
3113
  document.dispatchEvent(new CustomEvent("eletrack_download", {
3118
- detail: e
3114
+ detail: event
3119
3115
  }));
3120
- } else if (e.downloadLink == 'link' || e.downloadLink === true) {
3121
- e.confirm();
3116
+ } else if (_this20.options.downloadLink == 'link' || _this20.options.downloadLink === true) {
3117
+ event.confirm();
3122
3118
  }
3123
3119
 
3124
- _this20._fireEvt('eletrack_download', {
3125
- downloadLink: _this20.options.downloadLink,
3126
- confirm: saveFile.bind(_this20, _this20._downloadURL)
3127
- });
3120
+ _this20._fireEvt('eletrack_download', event);
3128
3121
  };
3129
3122
  }
3130
3123
  },