@raruto/leaflet-elevation 1.7.0 → 1.7.4

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.
@@ -172,7 +172,8 @@
172
172
  } : L.extend({
173
173
  lazy: true
174
174
  }, control.options.distanceMarkers);
175
- var wptIcons = control.options.gpxOptions.marker_options.wptIcons;
175
+ var wptIcons = control.options.wptIcons;
176
+ var wptLabels = control.options.wptLabels;
176
177
  var layer = L.geoJson(data, {
177
178
  distanceMarkers: distanceMarkers,
178
179
  style: function style(feature) {
@@ -185,37 +186,53 @@
185
186
  return style;
186
187
  },
187
188
  pointToLayer: function pointToLayer(feature, latlng) {
189
+ var _prop$desc, _prop$name, _prop$sym;
190
+
188
191
  if (!control.options.waypoints) return;
189
192
  var prop = feature.properties;
190
- var desc = prop.desc ? prop.desc : '';
191
- var name = prop.name ? prop.name : '';
192
- var sym = (prop.sym ? prop.sym : name).replace(' ', '-').replace('"', '').replace("'", '').toLowerCase(); // generate appropriate icon symbol or retrieve it from cache
193
-
194
- wptIcons[sym] = wptIcons[sym] ? wptIcons[sym] : L.divIcon({
195
- className: 'elevation-waypoint-marker',
196
- html: '<i class="elevation-waypoint-icon ' + sym + '"></i>',
197
- iconSize: [30, 30],
198
- iconAnchor: [8, 30]
199
- });
200
- var marker = L.marker(latlng, {
201
- icon: wptIcons[sym]
202
- });
193
+ var desc = (_prop$desc = prop.desc) !== null && _prop$desc !== void 0 ? _prop$desc : '';
194
+ var name = (_prop$name = prop.name) !== null && _prop$name !== void 0 ? _prop$name : '';
195
+ var sym = ((_prop$sym = prop.sym) !== null && _prop$sym !== void 0 ? _prop$sym : name).replace(' ', '-').replace('"', '').replace("'", '').toLowerCase(); // Handle waypoint lables (markers and dots)
196
+
197
+ if (!wptLabels) {
198
+ name = '';
199
+ desc = '';
200
+ } // Handle chart waypoints (dots)
201
+
202
+
203
+ if ([true, "dots"].includes(control.options.waypoints)) {
204
+ control._registerCheckPoint({
205
+ latlng: latlng,
206
+ label: name
207
+ }, true);
208
+ } // Handle map waypoints (markers)
209
+
210
+
211
+ if ([true, "markers"].includes(control.options.waypoints) && wptIcons != false) {
212
+ // generate and cache appropriate icon symbol
213
+ if (!wptIcons.hasOwnProperty(sym)) {
214
+ wptIcons[sym] = L.divIcon(L.extend({}, wptIcons[""].options, {
215
+ html: '<i class="elevation-waypoint-icon ' + sym + '"></i>'
216
+ }));
217
+ }
203
218
 
204
- if (name || desc) {
205
- marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
206
- }
219
+ var marker = L.marker(latlng, {
220
+ icon: wptIcons[sym]
221
+ });
207
222
 
208
- control._registerCheckPoint({
209
- latlng: latlng,
210
- label: name
211
- }, true);
223
+ if (name || desc) {
224
+ marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
225
+ }
212
226
 
213
- control.fire('waypoint_added', {
214
- point: marker,
215
- element: latlng,
216
- properties: prop
217
- });
218
- return marker;
227
+ control._addMarker(marker);
228
+
229
+ control.fire('waypoint_added', {
230
+ point: marker,
231
+ element: latlng,
232
+ properties: prop
233
+ });
234
+ return marker;
235
+ }
219
236
  },
220
237
  onEachFeature: function onEachFeature(feature, layer) {
221
238
  if (feature.geometry && feature.geometry.type == 'Point') return; // Standard GeoJSON
@@ -969,7 +986,12 @@
969
986
  var _height = height - margins.top - margins.bottom;
970
987
 
971
988
  svg.attr("viewBox", "0 0 ".concat(width, " ").concat(height)).attr("width", width).attr("height", height);
972
- g.attr("transform", "translate(" + margins.left + "," + margins.top + ")");
989
+ g.attr("transform", "translate(" + margins.left + "," + margins.top + ")"); // Partially fix: https://github.com/Raruto/leaflet-elevation/issues/123
990
+
991
+ if (/Mac|iPod|iPhone|iPad/.test(navigator.platform) && /AppleWebkit/i.test(navigator.userAgent)) {
992
+ canvas.style("transform", "translate(" + margins.left + "px," + margins.top + "px)");
993
+ }
994
+
973
995
  clipRect.attr("x", 0).attr("y", 0).attr("width", _width).attr("height", _height);
974
996
  foreignObject.attr('width', _width).attr('height', _height);
975
997
  canvas.attr('width', _width).attr('height', _height);
@@ -1124,6 +1146,8 @@
1124
1146
  clear: function clear() {
1125
1147
  this._resetDrag();
1126
1148
 
1149
+ this._hideDiagramIndicator();
1150
+
1127
1151
  this._area.selectAll('path').attr("d", "M0 0");
1128
1152
 
1129
1153
  this._context.clearRect(0, 0, this._width(), this._height());
@@ -1194,6 +1218,7 @@
1194
1218
  var _this2 = this;
1195
1219
 
1196
1220
  var brush = function brush(e) {
1221
+ if (!_this2._data.length) return;
1197
1222
  var extent = e.selection;
1198
1223
 
1199
1224
  if (extent) {
@@ -1209,6 +1234,7 @@
1209
1234
  };
1210
1235
 
1211
1236
  var focus = function focus(e) {
1237
+ if (!_this2._data.length) return;
1212
1238
  if (e.type == 'brush' && !e.sourceEvent) return;
1213
1239
 
1214
1240
  var rect = _this2._chart.panes.brush.select('.overlay').node();
@@ -2013,22 +2039,6 @@
2013
2039
  elevationDiv: "#elevation-div",
2014
2040
  followMarker: true,
2015
2041
  forceAxisBounds: false,
2016
- gpxOptions: {
2017
- async: true,
2018
- marker_options: {
2019
- startIconUrl: null,
2020
- endIconUrl: null,
2021
- shadowUrl: null,
2022
- wptIcons: {
2023
- '': L.divIcon({
2024
- className: 'elevation-waypoint-marker',
2025
- html: '<i class="elevation-waypoint-icon"></i>',
2026
- iconSize: [30, 30],
2027
- iconAnchor: [8, 30]
2028
- })
2029
- }
2030
- }
2031
- },
2032
2042
  height: 200,
2033
2043
  heightFactor: 1,
2034
2044
  imperial: false,
@@ -2084,6 +2094,15 @@
2084
2094
  sRange: undefined,
2085
2095
  width: 600,
2086
2096
  waypoints: true,
2097
+ wptIcons: {
2098
+ '': L.divIcon({
2099
+ className: 'elevation-waypoint-marker',
2100
+ html: '<i class="elevation-waypoint-icon"></i>',
2101
+ iconSize: [30, 30],
2102
+ iconAnchor: [8, 30]
2103
+ })
2104
+ },
2105
+ wptLabels: true,
2087
2106
  xAttr: "dist",
2088
2107
  xLabel: "km",
2089
2108
  xTicks: undefined,
@@ -2105,7 +2124,7 @@
2105
2124
  __TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.3.0/dist/togeojson.umd.js',
2106
2125
  __LGEOMUTIL: 'https://unpkg.com/leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js',
2107
2126
  __LALMOSTOVER: 'https://unpkg.com/leaflet-almostover@1.0.1/src/leaflet.almostover.js',
2108
- __LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.7.0/libs/leaflet-distance-marker.min.js',
2127
+ __LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.7.3/libs/leaflet-distance-marker.min.js',
2109
2128
 
2110
2129
  /*
2111
2130
  * Add data to the diagram either from GPX or GeoJSON and update the axis domain and data
@@ -2113,7 +2132,7 @@
2113
2132
  addData: function addData(d, layer) {
2114
2133
  var _this = this;
2115
2134
 
2116
- if ((typeof layer === "undefined" || layer === null) && d.on) {
2135
+ if (typeof layer === "undefined" && d.on) {
2117
2136
  layer = d;
2118
2137
  }
2119
2138
 
@@ -2152,12 +2171,48 @@
2152
2171
  */
2153
2172
  clear: function clear() {
2154
2173
  if (this._marker) this._marker.remove();
2155
- if (this._chart) this._chart.clear();
2156
- if (this._layers) this._layers.clearLayers();
2174
+ if (this._chart) this._clearChart();
2175
+ if (this._layers) this._clearLayers();
2176
+ if (this._markers) this._clearMarkers();
2157
2177
  this._data = [];
2158
2178
  this.track_info = {};
2159
2179
 
2160
2180
  this._fireEvt("eledata_clear");
2181
+
2182
+ this._updateChart();
2183
+ },
2184
+ _clearChart: function _clearChart() {
2185
+ var _this2 = this;
2186
+
2187
+ if (this._events && this._events.elechart_updated) {
2188
+ this._events.elechart_updated.forEach(function (e) {
2189
+ return _this2.off('elechart_updated', e.fn, e.ctx);
2190
+ });
2191
+ }
2192
+
2193
+ if (this._chart && this._chart._container) {
2194
+ this._chart._container.selectAll('g.point .point').remove();
2195
+
2196
+ this._chart.clear();
2197
+ }
2198
+ },
2199
+ _clearLayers: function _clearLayers() {
2200
+ if (this._layers && this._layers.eachLayer) {
2201
+ this._layers.eachLayer(function (l) {
2202
+ return l.remove();
2203
+ });
2204
+
2205
+ this._layers.clearLayers();
2206
+ }
2207
+ },
2208
+ _clearMarkers: function _clearMarkers() {
2209
+ if (this._markers && this._markers.eachLayer) {
2210
+ this._markers.eachLayer(function (l) {
2211
+ return l.remove();
2212
+ });
2213
+
2214
+ this._markers.clearLayers();
2215
+ }
2161
2216
  },
2162
2217
 
2163
2218
  /**
@@ -2240,6 +2295,7 @@
2240
2295
  initialize: function initialize(options) {
2241
2296
  this._data = [];
2242
2297
  this._layers = L.featureGroup();
2298
+ this._markers = L.featureGroup();
2243
2299
  this._markedSegments = L.polyline([]);
2244
2300
  this._chartEnabled = true, this.track_info = {};
2245
2301
  this.options = deepMerge({}, this.options, options);
@@ -2255,9 +2311,10 @@
2255
2311
  // this._updateChart = _.debounce(this._updateChart, 300, this);
2256
2312
  // this._updateSummary = _.debounce(this._updateSummary, 300, this);
2257
2313
  // }
2258
- // Leaflet canvas renderer colors
2259
2314
 
2260
2315
 
2316
+ if (this.options.wptIcons === true) this.options.wptIcons = Options.wptIcons; // Leaflet canvas renderer colors
2317
+
2261
2318
  L.extend(Colors, this.options.colors || {});
2262
2319
  },
2263
2320
 
@@ -2308,14 +2365,14 @@
2308
2365
  * Load data from a remote url.
2309
2366
  */
2310
2367
  loadFile: function loadFile(url) {
2311
- var _this2 = this;
2368
+ var _this3 = this;
2312
2369
 
2313
2370
  fetch(url).then(function (response) {
2314
2371
  return response.text();
2315
2372
  }).then(function (data) {
2316
- _this2._downloadURL = url; // TODO: handle multiple urls?
2373
+ _this3._downloadURL = url; // TODO: handle multiple urls?
2317
2374
 
2318
- _this2.loadData(data, {
2375
+ _this3.loadData(data, {
2319
2376
  lazy: false,
2320
2377
  defer: false
2321
2378
  });
@@ -2342,7 +2399,7 @@
2342
2399
  * Load raw XML data.
2343
2400
  */
2344
2401
  loadXML: function loadXML(data) {
2345
- var _this3 = this;
2402
+ var _this4 = this;
2346
2403
 
2347
2404
  Elevation._togeojsonLazyLoader = lazyLoader(this.__TOGEOJSON, typeof toGeoJSON !== 'function' || !this.options.lazyLoadJS, Elevation._togeojsonLazyLoader).then(function () {
2348
2405
  var xml = new DOMParser().parseFromString(data, "text/xml");
@@ -2357,11 +2414,11 @@
2357
2414
 
2358
2415
  if (name[0]) {
2359
2416
  geojson.name = name[0].innerHTML;
2360
- } else if (_this3._downloadURL) {
2361
- geojson.name = _this3._downloadURL.split('/').pop().split('#')[0].split('?')[0];
2417
+ } else if (_this4._downloadURL) {
2418
+ geojson.name = _this4._downloadURL.split('/').pop().split('#')[0].split('?')[0];
2362
2419
  }
2363
2420
 
2364
- return _this3.loadGeoJSON(geojson, _this3);
2421
+ return _this4.loadGeoJSON(geojson, _this4);
2365
2422
  });
2366
2423
  },
2367
2424
 
@@ -2369,7 +2426,7 @@
2369
2426
  * Wait for chart container visible before download data.
2370
2427
  */
2371
2428
  loadLazy: function loadLazy(data, opts) {
2372
- var _this4 = this;
2429
+ var _this5 = this;
2373
2430
 
2374
2431
  opts = L.extend({}, this.options.loadData, opts);
2375
2432
  var elem = opts.lazy.parentNode ? opts.lazy : this.placeholder;
@@ -2377,10 +2434,10 @@
2377
2434
  waitHolder(elem).then(function () {
2378
2435
  opts.lazy = false;
2379
2436
 
2380
- _this4.loadData(data, opts);
2437
+ _this5.loadData(data, opts);
2381
2438
 
2382
- _this4.once('eledata_loaded', function () {
2383
- return _this4.placeholder.parentNode.removeChild(elem);
2439
+ _this5.once('eledata_loaded', function () {
2440
+ return _this5.placeholder.parentNode.removeChild(elem);
2384
2441
  });
2385
2442
  });
2386
2443
  },
@@ -2390,7 +2447,7 @@
2390
2447
  * Called on control.addTo(map).
2391
2448
  */
2392
2449
  onAdd: function onAdd(map) {
2393
- var _this5 = this;
2450
+ var _this6 = this;
2394
2451
 
2395
2452
  this._map = map;
2396
2453
 
@@ -2410,27 +2467,27 @@
2410
2467
  }
2411
2468
 
2412
2469
  Elevation._d3LazyLoader = lazyLoader(this.__D3, (typeof d3 === "undefined" ? "undefined" : _typeof(d3)) !== 'object' || !this.options.lazyLoadJS, Elevation._d3LazyLoader).then(function () {
2413
- _this5._initButton(container);
2470
+ _this6._initButton(container);
2414
2471
 
2415
- _this5._initChart(container);
2472
+ _this6._initChart(container);
2416
2473
 
2417
- _this5._initSummary(container);
2474
+ _this6._initSummary(container);
2418
2475
 
2419
- _this5._initMarker(map);
2476
+ _this6._initMarker(map);
2420
2477
 
2421
- _this5._initLayer(map);
2478
+ _this6._initLayer(map);
2422
2479
 
2423
- map.on('zoom viewreset zoomanim', _this5._hideMarker, _this5).on('resize', _this5._resetView, _this5).on('resize', _this5._resizeChart, _this5).on('rotate', _this5._rotateMarker, _this5).on('mousedown', _this5._resetDrag, _this5);
2480
+ map.on('zoom viewreset zoomanim', _this6._hideMarker, _this6).on('resize', _this6._resetView, _this6).on('resize', _this6._resizeChart, _this6).on('rotate', _this6._rotateMarker, _this6).on('mousedown', _this6._resetDrag, _this6);
2424
2481
 
2425
- on(map.getContainer(), 'mousewheel', _this5._resetDrag, _this5);
2482
+ on(map.getContainer(), 'mousewheel', _this6._resetDrag, _this6);
2426
2483
 
2427
- on(map.getContainer(), 'touchstart', _this5._resetDrag, _this5);
2484
+ on(map.getContainer(), 'touchstart', _this6._resetDrag, _this6);
2428
2485
 
2429
- _this5.on('eledata_added eledata_loaded', _this5._updateChart, _this5).on('eledata_added eledata_loaded', _this5._updateSummary, _this5);
2486
+ _this6.on('eledata_added eledata_loaded', _this6._updateChart, _this6).on('eledata_added eledata_loaded', _this6._updateSummary, _this6);
2430
2487
 
2431
- _this5._updateChart();
2488
+ _this6._updateChart();
2432
2489
 
2433
- _this5._updateSummary();
2490
+ _this6._updateSummary();
2434
2491
  });
2435
2492
  return container;
2436
2493
  },
@@ -2475,7 +2532,7 @@
2475
2532
  * Parsing data either from GPX or GeoJSON and update the diagram data
2476
2533
  */
2477
2534
  _addData: function _addData(d) {
2478
- var _this6 = this;
2535
+ var _this7 = this;
2479
2536
 
2480
2537
  if (!d) {
2481
2538
  return;
@@ -2492,7 +2549,7 @@
2492
2549
 
2493
2550
  case 'MultiLineString':
2494
2551
  each(geom.coordinates, function (coords) {
2495
- return _this6._addGeoJSONData(coords);
2552
+ return _this7._addGeoJSONData(coords);
2496
2553
  });
2497
2554
 
2498
2555
  break;
@@ -2504,7 +2561,7 @@
2504
2561
 
2505
2562
  if (d.type === "FeatureCollection") {
2506
2563
  each(d.features, function (feature) {
2507
- return _this6._addData(feature);
2564
+ return _this7._addData(feature);
2508
2565
  });
2509
2566
  }
2510
2567
 
@@ -2517,14 +2574,14 @@
2517
2574
  * Parsing of GeoJSON data lines and their elevation in z-coordinate
2518
2575
  */
2519
2576
  _addGeoJSONData: function _addGeoJSONData(coords) {
2520
- var _this7 = this;
2577
+ var _this8 = this;
2521
2578
 
2522
2579
  each(coords, function (point) {
2523
- _this7._addPoint(point[1], point[0], point[2]);
2580
+ _this8._addPoint(point[1], point[0], point[2]);
2524
2581
 
2525
- _this7._fireEvt("elepoint_added", {
2582
+ _this8._fireEvt("elepoint_added", {
2526
2583
  point: point,
2527
- index: _this7._data.length - 1
2584
+ index: _this8._data.length - 1
2528
2585
  });
2529
2586
  });
2530
2587
 
@@ -2538,14 +2595,14 @@
2538
2595
  * Parsing function for GPX data and their elevation in z-coordinate
2539
2596
  */
2540
2597
  _addGPXData: function _addGPXData(coords) {
2541
- var _this8 = this;
2598
+ var _this9 = this;
2542
2599
 
2543
2600
  each(coords, function (point) {
2544
- _this8._addPoint(point.lat, point.lng, point.meta.ele);
2601
+ _this9._addPoint(point.lat, point.lng, typeof point.alt !== "undefined" ? point.alt : point.meta.ele);
2545
2602
 
2546
- _this8._fireEvt("elepoint_added", {
2603
+ _this9._fireEvt("elepoint_added", {
2547
2604
  point: point,
2548
- index: _this8._data.length - 1
2605
+ index: _this9._data.length - 1
2549
2606
  });
2550
2607
  });
2551
2608
 
@@ -2579,6 +2636,9 @@
2579
2636
  _addLayer: function _addLayer(layer) {
2580
2637
  if (layer) this._layers.addLayer(layer);
2581
2638
  },
2639
+ _addMarker: function _addMarker(marker) {
2640
+ if (marker) this._markers.addLayer(marker);
2641
+ },
2582
2642
 
2583
2643
  /**
2584
2644
  * Adds the control to the given "detached" div.
@@ -2693,17 +2753,17 @@
2693
2753
  this._fireEvt("elechart_init");
2694
2754
  },
2695
2755
  _initLayer: function _initLayer() {
2696
- var _this9 = this;
2756
+ var _this10 = this;
2697
2757
 
2698
2758
  this._layers.on('layeradd layerremove', function (e) {
2699
2759
  var layer = e.layer;
2700
2760
  var node = layer.getElement && layer.getElement();
2701
2761
 
2702
- toggleClass(node, _this9.options.polyline.className + ' ' + _this9.options.theme, e.type == 'layeradd');
2762
+ toggleClass(node, _this10.options.polyline.className + ' ' + _this10.options.theme, e.type == 'layeradd');
2703
2763
 
2704
- toggleEvent(layer, "mousemove", _this9._mousemoveLayerHandler.bind(_this9), e.type == 'layeradd');
2764
+ toggleEvent(layer, "mousemove", _this10._mousemoveLayerHandler.bind(_this10), e.type == 'layeradd');
2705
2765
 
2706
- toggleEvent(layer, "mouseout", _this9._mouseoutHandler.bind(_this9), e.type == 'layeradd');
2766
+ toggleEvent(layer, "mouseout", _this10._mouseoutHandler.bind(_this10), e.type == 'layeradd');
2707
2767
  });
2708
2768
  },
2709
2769
  _initMarker: function _initMarker(map) {
@@ -2877,10 +2937,10 @@
2877
2937
  * Add a waypoint marker to the diagram
2878
2938
  */
2879
2939
  _registerCheckPoint: function _registerCheckPoint(props) {
2880
- var _this10 = this;
2940
+ var _this11 = this;
2881
2941
 
2882
2942
  this.on("elechart_updated", function () {
2883
- return _this10._chart._registerCheckPoint(props);
2943
+ return _this11._chart._registerCheckPoint(props);
2884
2944
  });
2885
2945
  },
2886
2946
 
@@ -2888,10 +2948,10 @@
2888
2948
  * Add chart profile to diagram
2889
2949
  */
2890
2950
  _registerAreaPath: function _registerAreaPath(props) {
2891
- var _this11 = this;
2951
+ var _this12 = this;
2892
2952
 
2893
2953
  this.on("elechart_init", function () {
2894
- return _this11._chart._registerAreaPath(props);
2954
+ return _this12._chart._registerAreaPath(props);
2895
2955
  });
2896
2956
  },
2897
2957
 
@@ -2899,10 +2959,10 @@
2899
2959
  * Add chart grid to diagram
2900
2960
  */
2901
2961
  _registerAxisGrid: function _registerAxisGrid(props) {
2902
- var _this12 = this;
2962
+ var _this13 = this;
2903
2963
 
2904
2964
  this.on("elechart_axis", function () {
2905
- return _this12._chart._registerAxisGrid(props);
2965
+ return _this13._chart._registerAxisGrid(props);
2906
2966
  });
2907
2967
  },
2908
2968
 
@@ -2910,10 +2970,10 @@
2910
2970
  * Add chart axis to diagram
2911
2971
  */
2912
2972
  _registerAxisScale: function _registerAxisScale(props) {
2913
- var _this13 = this;
2973
+ var _this14 = this;
2914
2974
 
2915
2975
  this.on("elechart_axis", function () {
2916
- return _this13._chart._registerAxisScale(props);
2976
+ return _this14._chart._registerAxisScale(props);
2917
2977
  });
2918
2978
  },
2919
2979
 
@@ -2921,14 +2981,14 @@
2921
2981
  * Add chart or marker tooltip info
2922
2982
  */
2923
2983
  _registerFocusLabel: function _registerFocusLabel(props) {
2924
- var _this14 = this;
2984
+ var _this15 = this;
2925
2985
 
2926
2986
  if (props.chart) {
2927
2987
  var label = L.extend({}, props, {
2928
2988
  value: props.chart
2929
2989
  });
2930
2990
  this.on("elechart_init", function () {
2931
- return _this14._chart._registerFocusLabel(label);
2991
+ return _this15._chart._registerFocusLabel(label);
2932
2992
  });
2933
2993
  }
2934
2994
 
@@ -2938,7 +2998,7 @@
2938
2998
  });
2939
2999
 
2940
3000
  this.on("elechart_marker", function () {
2941
- return _this14._marker._registerFocusLabel(_label);
3001
+ return _this15._marker._registerFocusLabel(_label);
2942
3002
  });
2943
3003
  }
2944
3004
  },
@@ -2947,10 +3007,10 @@
2947
3007
  * Add summary info to diagram
2948
3008
  */
2949
3009
  _registerSummary: function _registerSummary(props) {
2950
- var _this15 = this;
3010
+ var _this16 = this;
2951
3011
 
2952
3012
  this.on('elechart_summary', function () {
2953
- return _this15._summary._registerSummary(props);
3013
+ return _this16._summary._registerSummary(props);
2954
3014
  });
2955
3015
  },
2956
3016
 
@@ -3057,7 +3117,7 @@
3057
3117
  * Toggle chart data on legend click
3058
3118
  */
3059
3119
  _toggleChartHandler: function _toggleChartHandler(e) {
3060
- var _this16 = this;
3120
+ var _this17 = this;
3061
3121
 
3062
3122
  var path = e.path,
3063
3123
  name = e.name,
@@ -3067,7 +3127,7 @@
3067
3127
  this._layers.eachLayer(function (layer) {
3068
3128
  var node = layer.getElement && layer.getElement();
3069
3129
 
3070
- toggleClass(node, _this16.options.polyline.className + ' ' + _this16.options.theme, _this16._chartEnabled);
3130
+ toggleClass(node, _this17.options.polyline.className + ' ' + _this17.options.theme, _this17._chartEnabled);
3071
3131
  }); // toggle option value (eg. altitude = { 'disabled' || 'disabled' })
3072
3132
 
3073
3133
 
@@ -3084,7 +3144,9 @@
3084
3144
  * Calculates [x, y] domain and then update chart.
3085
3145
  */
3086
3146
  _updateChart: function _updateChart() {
3087
- if (!this._data.length || !this._container) return;
3147
+ if (
3148
+ /*!this._data.length ||*/
3149
+ !this._container) return;
3088
3150
 
3089
3151
  this._fireEvt("elechart_axis");
3090
3152
 
@@ -3139,7 +3201,7 @@
3139
3201
  * Update chart summary.
3140
3202
  */
3141
3203
  _updateSummary: function _updateSummary() {
3142
- var _this17 = this;
3204
+ var _this18 = this;
3143
3205
 
3144
3206
  this._summary.reset();
3145
3207
 
@@ -3154,9 +3216,9 @@
3154
3216
  select('.download a', this.summaryDiv).onclick = function (e) {
3155
3217
  e.preventDefault();
3156
3218
 
3157
- _this17._fireEvt('eletrack_download', {
3158
- downloadLink: _this17.options.downloadLink,
3159
- confirm: saveFile.bind(_this17, _this17._downloadURL)
3219
+ _this18._fireEvt('eletrack_download', {
3220
+ downloadLink: _this18.options.downloadLink,
3221
+ confirm: saveFile.bind(_this18, _this18._downloadURL)
3160
3222
  });
3161
3223
  };
3162
3224
  }
@@ -3220,7 +3282,7 @@
3220
3282
  }
3221
3283
  });
3222
3284
  this.on('eledata_loaded', function (e) {
3223
- var _this18 = this;
3285
+ var _this19 = this;
3224
3286
 
3225
3287
  var map = this._map;
3226
3288
  var layer = e.layer;
@@ -3231,7 +3293,7 @@
3231
3293
  }
3232
3294
 
3233
3295
  map.once('layeradd', function (e) {
3234
- return _this18.options.autofitBounds && _this18.fitBounds(layer.getBounds());
3296
+ return _this19.options.autofitBounds && _this19.fitBounds(layer.getBounds());
3235
3297
  });
3236
3298
 
3237
3299
  if (L.Browser.mobile) {
@@ -3240,28 +3302,28 @@
3240
3302
  // leaflet-geometryutil
3241
3303
  Elevation._geomutilLazyLoader = lazyLoader(this.__LGEOMUTIL, typeof L.GeometryUtil !== 'function' || !this.options.lazyLoadJS, Elevation._geomutilLazyLoader).then(function () {
3242
3304
  // leaflet-almostover
3243
- if (_this18.options.almostOver) {
3244
- Elevation._almostoverLazyLoader = lazyLoader(_this18.__LALMOSTOVER, typeof L.Handler.AlmostOver !== 'function' || !_this18.options.lazyLoadJS, Elevation._almostoverLazyLoader).then(function () {
3305
+ if (_this19.options.almostOver) {
3306
+ Elevation._almostoverLazyLoader = lazyLoader(_this19.__LALMOSTOVER, typeof L.Handler.AlmostOver !== 'function' || !_this19.options.lazyLoadJS, Elevation._almostoverLazyLoader).then(function () {
3245
3307
  map.addHandler('almostOver', L.Handler.AlmostOver);
3246
3308
 
3247
3309
  if (L.GeometryUtil && map.almostOver && map.almostOver.enabled()) {
3248
3310
  map.almostOver.addLayer(layer);
3249
3311
  map.on('almost:move', function (e) {
3250
- return _this18._mousemoveLayerHandler(e);
3312
+ return _this19._mousemoveLayerHandler(e);
3251
3313
  }).on('almost:out', function (e) {
3252
- return _this18._mouseoutHandler(e);
3314
+ return _this19._mouseoutHandler(e);
3253
3315
  });
3254
3316
  }
3255
3317
  });
3256
3318
  } // leaflet-distance-markers
3257
3319
 
3258
3320
 
3259
- if (_this18.options.distanceMarkers) {
3260
- Elevation._distanceMarkersLazyLoader = lazyLoader(_this18.__LDISTANCEM, typeof L.DistanceMarkers !== 'function' || !_this18.options.lazyLoadJS, Elevation._distanceMarkersLazyLoader).then(function () {
3261
- return _this18.options.polyline && layer.addTo(map);
3321
+ if (_this19.options.distanceMarkers) {
3322
+ Elevation._distanceMarkersLazyLoader = lazyLoader(_this19.__LDISTANCEM, typeof L.DistanceMarkers !== 'function' || !_this19.options.lazyLoadJS, Elevation._distanceMarkersLazyLoader).then(function () {
3323
+ return _this19.options.polyline && layer.addTo(map);
3262
3324
  });
3263
3325
  } else {
3264
- if (_this18.options.polyline) layer.addTo(map);
3326
+ if (_this19.options.polyline) layer.addTo(map);
3265
3327
  }
3266
3328
  });
3267
3329
  }