@raruto/leaflet-elevation 1.7.1 → 1.7.5
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 +5 -2
- package/dist/leaflet-elevation.js +119 -100
- package/dist/leaflet-elevation.js.map +1 -1
- package/dist/leaflet-elevation.min.js +1 -1
- package/dist/leaflet-elevation.min.js.map +1 -1
- package/libs/leaflet-gpxgroup.js +48 -35
- package/libs/leaflet-gpxgroup.min.js +14 -13
- package/package.json +1 -1
- package/src/components.js +7 -1
- package/src/control.js +6 -4
- package/src/options.js +1 -0
- package/src/utils.js +37 -25
package/README.md
CHANGED
|
@@ -158,10 +158,10 @@ _For a working example see one of the following demos:_
|
|
|
158
158
|
// Toggle "leaflet-distance-markers" integration
|
|
159
159
|
distanceMarkers: false,
|
|
160
160
|
|
|
161
|
-
// Display track waypoints
|
|
161
|
+
// Display track waypoints: true || "markers" || "dots" || false
|
|
162
162
|
waypoints: true,
|
|
163
163
|
|
|
164
|
-
//
|
|
164
|
+
// Toggle custom waypoint icons: true || { associative array of <sym> tags } || false
|
|
165
165
|
wptIcons: {
|
|
166
166
|
'': L.divIcon({
|
|
167
167
|
className: 'elevation-waypoint-marker',
|
|
@@ -171,6 +171,9 @@ _For a working example see one of the following demos:_
|
|
|
171
171
|
}),
|
|
172
172
|
},
|
|
173
173
|
|
|
174
|
+
// Display waypoint labels: true || "markers" || "dots" || false
|
|
175
|
+
wptLabels: true,
|
|
176
|
+
|
|
174
177
|
// Render chart profiles as Canvas or SVG Paths
|
|
175
178
|
preferCanvas: true
|
|
176
179
|
|
|
@@ -172,7 +172,9 @@
|
|
|
172
172
|
} : L.extend({
|
|
173
173
|
lazy: true
|
|
174
174
|
}, control.options.distanceMarkers);
|
|
175
|
-
var
|
|
175
|
+
var _control$options = control.options,
|
|
176
|
+
wptIcons = _control$options.wptIcons,
|
|
177
|
+
wptLabels = _control$options.wptLabels;
|
|
176
178
|
var layer = L.geoJson(data, {
|
|
177
179
|
distanceMarkers: distanceMarkers,
|
|
178
180
|
style: function style(feature) {
|
|
@@ -185,39 +187,47 @@
|
|
|
185
187
|
return style;
|
|
186
188
|
},
|
|
187
189
|
pointToLayer: function pointToLayer(feature, latlng) {
|
|
190
|
+
var _prop$desc, _prop$name, _prop$sym;
|
|
191
|
+
|
|
188
192
|
if (!control.options.waypoints) return;
|
|
189
193
|
var prop = feature.properties;
|
|
190
|
-
var desc = prop.desc ?
|
|
191
|
-
var name = prop.name ?
|
|
192
|
-
var sym = (prop.sym ?
|
|
193
|
-
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
var desc = (_prop$desc = prop.desc) !== null && _prop$desc !== void 0 ? _prop$desc : '';
|
|
195
|
+
var name = (_prop$name = prop.name) !== null && _prop$name !== void 0 ? _prop$name : '';
|
|
196
|
+
var sym = ((_prop$sym = prop.sym) !== null && _prop$sym !== void 0 ? _prop$sym : name).replace(' ', '-').replace('"', '').replace("'", '').toLowerCase(); // Handle chart waypoints (dots)
|
|
197
|
+
|
|
198
|
+
if ([true, 'dots'].includes(control.options.waypoints)) {
|
|
199
|
+
control._registerCheckPoint({
|
|
200
|
+
latlng: latlng,
|
|
201
|
+
label: [true, 'dots'].includes(wptLabels) ? name : ''
|
|
202
|
+
}, true);
|
|
203
|
+
} // Handle map waypoints (markers)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if ([true, 'markers'].includes(control.options.waypoints) && wptIcons != false) {
|
|
207
|
+
// generate and cache appropriate icon symbol
|
|
208
|
+
if (!wptIcons.hasOwnProperty(sym)) {
|
|
209
|
+
wptIcons[sym] = L.divIcon(L.extend({}, wptIcons[""].options, {
|
|
210
|
+
html: '<i class="elevation-waypoint-icon ' + sym + '"></i>'
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
203
213
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
var marker = L.marker(latlng, {
|
|
215
|
+
icon: wptIcons[sym]
|
|
216
|
+
});
|
|
207
217
|
|
|
208
|
-
|
|
218
|
+
if ([true, 'markers'].includes(wptLabels) && (name || desc)) {
|
|
219
|
+
marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
|
|
220
|
+
}
|
|
209
221
|
|
|
210
|
-
|
|
211
|
-
latlng: latlng,
|
|
212
|
-
label: name
|
|
213
|
-
}, true);
|
|
222
|
+
control._addMarker(marker);
|
|
214
223
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
224
|
+
control.fire('waypoint_added', {
|
|
225
|
+
point: marker,
|
|
226
|
+
element: latlng,
|
|
227
|
+
properties: prop
|
|
228
|
+
});
|
|
229
|
+
return marker;
|
|
230
|
+
}
|
|
221
231
|
},
|
|
222
232
|
onEachFeature: function onEachFeature(feature, layer) {
|
|
223
233
|
if (feature.geometry && feature.geometry.type == 'Point') return; // Standard GeoJSON
|
|
@@ -971,7 +981,12 @@
|
|
|
971
981
|
var _height = height - margins.top - margins.bottom;
|
|
972
982
|
|
|
973
983
|
svg.attr("viewBox", "0 0 ".concat(width, " ").concat(height)).attr("width", width).attr("height", height);
|
|
974
|
-
g.attr("transform", "translate(" + margins.left + "," + margins.top + ")");
|
|
984
|
+
g.attr("transform", "translate(" + margins.left + "," + margins.top + ")"); // Partially fix: https://github.com/Raruto/leaflet-elevation/issues/123
|
|
985
|
+
|
|
986
|
+
if (/Mac|iPod|iPhone|iPad/.test(navigator.platform) && /AppleWebkit/i.test(navigator.userAgent)) {
|
|
987
|
+
canvas.style("transform", "translate(" + margins.left + "px," + margins.top + "px)");
|
|
988
|
+
}
|
|
989
|
+
|
|
975
990
|
clipRect.attr("x", 0).attr("y", 0).attr("width", _width).attr("height", _height);
|
|
976
991
|
foreignObject.attr('width', _width).attr('height', _height);
|
|
977
992
|
canvas.attr('width', _width).attr('height', _height);
|
|
@@ -2082,6 +2097,7 @@
|
|
|
2082
2097
|
iconAnchor: [8, 30]
|
|
2083
2098
|
})
|
|
2084
2099
|
},
|
|
2100
|
+
wptLabels: true,
|
|
2085
2101
|
xAttr: "dist",
|
|
2086
2102
|
xLabel: "km",
|
|
2087
2103
|
xTicks: undefined,
|
|
@@ -2103,7 +2119,7 @@
|
|
|
2103
2119
|
__TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.3.0/dist/togeojson.umd.js',
|
|
2104
2120
|
__LGEOMUTIL: 'https://unpkg.com/leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js',
|
|
2105
2121
|
__LALMOSTOVER: 'https://unpkg.com/leaflet-almostover@1.0.1/src/leaflet.almostover.js',
|
|
2106
|
-
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.7.
|
|
2122
|
+
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.7.5/libs/leaflet-distance-marker.min.js',
|
|
2107
2123
|
|
|
2108
2124
|
/*
|
|
2109
2125
|
* Add data to the diagram either from GPX or GeoJSON and update the axis domain and data
|
|
@@ -2111,7 +2127,7 @@
|
|
|
2111
2127
|
addData: function addData(d, layer) {
|
|
2112
2128
|
var _this = this;
|
|
2113
2129
|
|
|
2114
|
-
if (
|
|
2130
|
+
if (typeof layer === "undefined" && d.on) {
|
|
2115
2131
|
layer = d;
|
|
2116
2132
|
}
|
|
2117
2133
|
|
|
@@ -2161,9 +2177,11 @@
|
|
|
2161
2177
|
this._updateChart();
|
|
2162
2178
|
},
|
|
2163
2179
|
_clearChart: function _clearChart() {
|
|
2180
|
+
var _this2 = this;
|
|
2181
|
+
|
|
2164
2182
|
if (this._events && this._events.elechart_updated) {
|
|
2165
2183
|
this._events.elechart_updated.forEach(function (e) {
|
|
2166
|
-
return
|
|
2184
|
+
return _this2.off('elechart_updated', e.fn, e.ctx);
|
|
2167
2185
|
});
|
|
2168
2186
|
}
|
|
2169
2187
|
|
|
@@ -2288,9 +2306,10 @@
|
|
|
2288
2306
|
// this._updateChart = _.debounce(this._updateChart, 300, this);
|
|
2289
2307
|
// this._updateSummary = _.debounce(this._updateSummary, 300, this);
|
|
2290
2308
|
// }
|
|
2291
|
-
// Leaflet canvas renderer colors
|
|
2292
2309
|
|
|
2293
2310
|
|
|
2311
|
+
if (this.options.wptIcons === true) this.options.wptIcons = Options.wptIcons; // Leaflet canvas renderer colors
|
|
2312
|
+
|
|
2294
2313
|
L.extend(Colors, this.options.colors || {});
|
|
2295
2314
|
},
|
|
2296
2315
|
|
|
@@ -2341,14 +2360,14 @@
|
|
|
2341
2360
|
* Load data from a remote url.
|
|
2342
2361
|
*/
|
|
2343
2362
|
loadFile: function loadFile(url) {
|
|
2344
|
-
var
|
|
2363
|
+
var _this3 = this;
|
|
2345
2364
|
|
|
2346
2365
|
fetch(url).then(function (response) {
|
|
2347
2366
|
return response.text();
|
|
2348
2367
|
}).then(function (data) {
|
|
2349
|
-
|
|
2368
|
+
_this3._downloadURL = url; // TODO: handle multiple urls?
|
|
2350
2369
|
|
|
2351
|
-
|
|
2370
|
+
_this3.loadData(data, {
|
|
2352
2371
|
lazy: false,
|
|
2353
2372
|
defer: false
|
|
2354
2373
|
});
|
|
@@ -2375,7 +2394,7 @@
|
|
|
2375
2394
|
* Load raw XML data.
|
|
2376
2395
|
*/
|
|
2377
2396
|
loadXML: function loadXML(data) {
|
|
2378
|
-
var
|
|
2397
|
+
var _this4 = this;
|
|
2379
2398
|
|
|
2380
2399
|
Elevation._togeojsonLazyLoader = lazyLoader(this.__TOGEOJSON, typeof toGeoJSON !== 'function' || !this.options.lazyLoadJS, Elevation._togeojsonLazyLoader).then(function () {
|
|
2381
2400
|
var xml = new DOMParser().parseFromString(data, "text/xml");
|
|
@@ -2390,11 +2409,11 @@
|
|
|
2390
2409
|
|
|
2391
2410
|
if (name[0]) {
|
|
2392
2411
|
geojson.name = name[0].innerHTML;
|
|
2393
|
-
} else if (
|
|
2394
|
-
geojson.name =
|
|
2412
|
+
} else if (_this4._downloadURL) {
|
|
2413
|
+
geojson.name = _this4._downloadURL.split('/').pop().split('#')[0].split('?')[0];
|
|
2395
2414
|
}
|
|
2396
2415
|
|
|
2397
|
-
return
|
|
2416
|
+
return _this4.loadGeoJSON(geojson, _this4);
|
|
2398
2417
|
});
|
|
2399
2418
|
},
|
|
2400
2419
|
|
|
@@ -2402,7 +2421,7 @@
|
|
|
2402
2421
|
* Wait for chart container visible before download data.
|
|
2403
2422
|
*/
|
|
2404
2423
|
loadLazy: function loadLazy(data, opts) {
|
|
2405
|
-
var
|
|
2424
|
+
var _this5 = this;
|
|
2406
2425
|
|
|
2407
2426
|
opts = L.extend({}, this.options.loadData, opts);
|
|
2408
2427
|
var elem = opts.lazy.parentNode ? opts.lazy : this.placeholder;
|
|
@@ -2410,10 +2429,10 @@
|
|
|
2410
2429
|
waitHolder(elem).then(function () {
|
|
2411
2430
|
opts.lazy = false;
|
|
2412
2431
|
|
|
2413
|
-
|
|
2432
|
+
_this5.loadData(data, opts);
|
|
2414
2433
|
|
|
2415
|
-
|
|
2416
|
-
return
|
|
2434
|
+
_this5.once('eledata_loaded', function () {
|
|
2435
|
+
return _this5.placeholder.parentNode.removeChild(elem);
|
|
2417
2436
|
});
|
|
2418
2437
|
});
|
|
2419
2438
|
},
|
|
@@ -2423,7 +2442,7 @@
|
|
|
2423
2442
|
* Called on control.addTo(map).
|
|
2424
2443
|
*/
|
|
2425
2444
|
onAdd: function onAdd(map) {
|
|
2426
|
-
var
|
|
2445
|
+
var _this6 = this;
|
|
2427
2446
|
|
|
2428
2447
|
this._map = map;
|
|
2429
2448
|
|
|
@@ -2443,27 +2462,27 @@
|
|
|
2443
2462
|
}
|
|
2444
2463
|
|
|
2445
2464
|
Elevation._d3LazyLoader = lazyLoader(this.__D3, (typeof d3 === "undefined" ? "undefined" : _typeof(d3)) !== 'object' || !this.options.lazyLoadJS, Elevation._d3LazyLoader).then(function () {
|
|
2446
|
-
|
|
2465
|
+
_this6._initButton(container);
|
|
2447
2466
|
|
|
2448
|
-
|
|
2467
|
+
_this6._initChart(container);
|
|
2449
2468
|
|
|
2450
|
-
|
|
2469
|
+
_this6._initSummary(container);
|
|
2451
2470
|
|
|
2452
|
-
|
|
2471
|
+
_this6._initMarker(map);
|
|
2453
2472
|
|
|
2454
|
-
|
|
2473
|
+
_this6._initLayer(map);
|
|
2455
2474
|
|
|
2456
|
-
map.on('zoom viewreset zoomanim',
|
|
2475
|
+
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);
|
|
2457
2476
|
|
|
2458
|
-
on(map.getContainer(), 'mousewheel',
|
|
2477
|
+
on(map.getContainer(), 'mousewheel', _this6._resetDrag, _this6);
|
|
2459
2478
|
|
|
2460
|
-
on(map.getContainer(), 'touchstart',
|
|
2479
|
+
on(map.getContainer(), 'touchstart', _this6._resetDrag, _this6);
|
|
2461
2480
|
|
|
2462
|
-
|
|
2481
|
+
_this6.on('eledata_added eledata_loaded', _this6._updateChart, _this6).on('eledata_added eledata_loaded', _this6._updateSummary, _this6);
|
|
2463
2482
|
|
|
2464
|
-
|
|
2483
|
+
_this6._updateChart();
|
|
2465
2484
|
|
|
2466
|
-
|
|
2485
|
+
_this6._updateSummary();
|
|
2467
2486
|
});
|
|
2468
2487
|
return container;
|
|
2469
2488
|
},
|
|
@@ -2508,7 +2527,7 @@
|
|
|
2508
2527
|
* Parsing data either from GPX or GeoJSON and update the diagram data
|
|
2509
2528
|
*/
|
|
2510
2529
|
_addData: function _addData(d) {
|
|
2511
|
-
var
|
|
2530
|
+
var _this7 = this;
|
|
2512
2531
|
|
|
2513
2532
|
if (!d) {
|
|
2514
2533
|
return;
|
|
@@ -2525,7 +2544,7 @@
|
|
|
2525
2544
|
|
|
2526
2545
|
case 'MultiLineString':
|
|
2527
2546
|
each(geom.coordinates, function (coords) {
|
|
2528
|
-
return
|
|
2547
|
+
return _this7._addGeoJSONData(coords);
|
|
2529
2548
|
});
|
|
2530
2549
|
|
|
2531
2550
|
break;
|
|
@@ -2537,7 +2556,7 @@
|
|
|
2537
2556
|
|
|
2538
2557
|
if (d.type === "FeatureCollection") {
|
|
2539
2558
|
each(d.features, function (feature) {
|
|
2540
|
-
return
|
|
2559
|
+
return _this7._addData(feature);
|
|
2541
2560
|
});
|
|
2542
2561
|
}
|
|
2543
2562
|
|
|
@@ -2550,14 +2569,14 @@
|
|
|
2550
2569
|
* Parsing of GeoJSON data lines and their elevation in z-coordinate
|
|
2551
2570
|
*/
|
|
2552
2571
|
_addGeoJSONData: function _addGeoJSONData(coords) {
|
|
2553
|
-
var
|
|
2572
|
+
var _this8 = this;
|
|
2554
2573
|
|
|
2555
2574
|
each(coords, function (point) {
|
|
2556
|
-
|
|
2575
|
+
_this8._addPoint(point[1], point[0], point[2]);
|
|
2557
2576
|
|
|
2558
|
-
|
|
2577
|
+
_this8._fireEvt("elepoint_added", {
|
|
2559
2578
|
point: point,
|
|
2560
|
-
index:
|
|
2579
|
+
index: _this8._data.length - 1
|
|
2561
2580
|
});
|
|
2562
2581
|
});
|
|
2563
2582
|
|
|
@@ -2571,14 +2590,14 @@
|
|
|
2571
2590
|
* Parsing function for GPX data and their elevation in z-coordinate
|
|
2572
2591
|
*/
|
|
2573
2592
|
_addGPXData: function _addGPXData(coords) {
|
|
2574
|
-
var
|
|
2593
|
+
var _this9 = this;
|
|
2575
2594
|
|
|
2576
2595
|
each(coords, function (point) {
|
|
2577
|
-
|
|
2596
|
+
_this9._addPoint(point.lat, point.lng, typeof point.alt !== "undefined" ? point.alt : point.meta.ele);
|
|
2578
2597
|
|
|
2579
|
-
|
|
2598
|
+
_this9._fireEvt("elepoint_added", {
|
|
2580
2599
|
point: point,
|
|
2581
|
-
index:
|
|
2600
|
+
index: _this9._data.length - 1
|
|
2582
2601
|
});
|
|
2583
2602
|
});
|
|
2584
2603
|
|
|
@@ -2729,17 +2748,17 @@
|
|
|
2729
2748
|
this._fireEvt("elechart_init");
|
|
2730
2749
|
},
|
|
2731
2750
|
_initLayer: function _initLayer() {
|
|
2732
|
-
var
|
|
2751
|
+
var _this10 = this;
|
|
2733
2752
|
|
|
2734
2753
|
this._layers.on('layeradd layerremove', function (e) {
|
|
2735
2754
|
var layer = e.layer;
|
|
2736
2755
|
var node = layer.getElement && layer.getElement();
|
|
2737
2756
|
|
|
2738
|
-
toggleClass(node,
|
|
2757
|
+
toggleClass(node, _this10.options.polyline.className + ' ' + _this10.options.theme, e.type == 'layeradd');
|
|
2739
2758
|
|
|
2740
|
-
toggleEvent(layer, "mousemove",
|
|
2759
|
+
toggleEvent(layer, "mousemove", _this10._mousemoveLayerHandler.bind(_this10), e.type == 'layeradd');
|
|
2741
2760
|
|
|
2742
|
-
toggleEvent(layer, "mouseout",
|
|
2761
|
+
toggleEvent(layer, "mouseout", _this10._mouseoutHandler.bind(_this10), e.type == 'layeradd');
|
|
2743
2762
|
});
|
|
2744
2763
|
},
|
|
2745
2764
|
_initMarker: function _initMarker(map) {
|
|
@@ -2913,10 +2932,10 @@
|
|
|
2913
2932
|
* Add a waypoint marker to the diagram
|
|
2914
2933
|
*/
|
|
2915
2934
|
_registerCheckPoint: function _registerCheckPoint(props) {
|
|
2916
|
-
var
|
|
2935
|
+
var _this11 = this;
|
|
2917
2936
|
|
|
2918
2937
|
this.on("elechart_updated", function () {
|
|
2919
|
-
return
|
|
2938
|
+
return _this11._chart._registerCheckPoint(props);
|
|
2920
2939
|
});
|
|
2921
2940
|
},
|
|
2922
2941
|
|
|
@@ -2924,10 +2943,10 @@
|
|
|
2924
2943
|
* Add chart profile to diagram
|
|
2925
2944
|
*/
|
|
2926
2945
|
_registerAreaPath: function _registerAreaPath(props) {
|
|
2927
|
-
var
|
|
2946
|
+
var _this12 = this;
|
|
2928
2947
|
|
|
2929
2948
|
this.on("elechart_init", function () {
|
|
2930
|
-
return
|
|
2949
|
+
return _this12._chart._registerAreaPath(props);
|
|
2931
2950
|
});
|
|
2932
2951
|
},
|
|
2933
2952
|
|
|
@@ -2935,10 +2954,10 @@
|
|
|
2935
2954
|
* Add chart grid to diagram
|
|
2936
2955
|
*/
|
|
2937
2956
|
_registerAxisGrid: function _registerAxisGrid(props) {
|
|
2938
|
-
var
|
|
2957
|
+
var _this13 = this;
|
|
2939
2958
|
|
|
2940
2959
|
this.on("elechart_axis", function () {
|
|
2941
|
-
return
|
|
2960
|
+
return _this13._chart._registerAxisGrid(props);
|
|
2942
2961
|
});
|
|
2943
2962
|
},
|
|
2944
2963
|
|
|
@@ -2946,10 +2965,10 @@
|
|
|
2946
2965
|
* Add chart axis to diagram
|
|
2947
2966
|
*/
|
|
2948
2967
|
_registerAxisScale: function _registerAxisScale(props) {
|
|
2949
|
-
var
|
|
2968
|
+
var _this14 = this;
|
|
2950
2969
|
|
|
2951
2970
|
this.on("elechart_axis", function () {
|
|
2952
|
-
return
|
|
2971
|
+
return _this14._chart._registerAxisScale(props);
|
|
2953
2972
|
});
|
|
2954
2973
|
},
|
|
2955
2974
|
|
|
@@ -2957,14 +2976,14 @@
|
|
|
2957
2976
|
* Add chart or marker tooltip info
|
|
2958
2977
|
*/
|
|
2959
2978
|
_registerFocusLabel: function _registerFocusLabel(props) {
|
|
2960
|
-
var
|
|
2979
|
+
var _this15 = this;
|
|
2961
2980
|
|
|
2962
2981
|
if (props.chart) {
|
|
2963
2982
|
var label = L.extend({}, props, {
|
|
2964
2983
|
value: props.chart
|
|
2965
2984
|
});
|
|
2966
2985
|
this.on("elechart_init", function () {
|
|
2967
|
-
return
|
|
2986
|
+
return _this15._chart._registerFocusLabel(label);
|
|
2968
2987
|
});
|
|
2969
2988
|
}
|
|
2970
2989
|
|
|
@@ -2974,7 +2993,7 @@
|
|
|
2974
2993
|
});
|
|
2975
2994
|
|
|
2976
2995
|
this.on("elechart_marker", function () {
|
|
2977
|
-
return
|
|
2996
|
+
return _this15._marker._registerFocusLabel(_label);
|
|
2978
2997
|
});
|
|
2979
2998
|
}
|
|
2980
2999
|
},
|
|
@@ -2983,10 +3002,10 @@
|
|
|
2983
3002
|
* Add summary info to diagram
|
|
2984
3003
|
*/
|
|
2985
3004
|
_registerSummary: function _registerSummary(props) {
|
|
2986
|
-
var
|
|
3005
|
+
var _this16 = this;
|
|
2987
3006
|
|
|
2988
3007
|
this.on('elechart_summary', function () {
|
|
2989
|
-
return
|
|
3008
|
+
return _this16._summary._registerSummary(props);
|
|
2990
3009
|
});
|
|
2991
3010
|
},
|
|
2992
3011
|
|
|
@@ -3093,7 +3112,7 @@
|
|
|
3093
3112
|
* Toggle chart data on legend click
|
|
3094
3113
|
*/
|
|
3095
3114
|
_toggleChartHandler: function _toggleChartHandler(e) {
|
|
3096
|
-
var
|
|
3115
|
+
var _this17 = this;
|
|
3097
3116
|
|
|
3098
3117
|
var path = e.path,
|
|
3099
3118
|
name = e.name,
|
|
@@ -3103,7 +3122,7 @@
|
|
|
3103
3122
|
this._layers.eachLayer(function (layer) {
|
|
3104
3123
|
var node = layer.getElement && layer.getElement();
|
|
3105
3124
|
|
|
3106
|
-
toggleClass(node,
|
|
3125
|
+
toggleClass(node, _this17.options.polyline.className + ' ' + _this17.options.theme, _this17._chartEnabled);
|
|
3107
3126
|
}); // toggle option value (eg. altitude = { 'disabled' || 'disabled' })
|
|
3108
3127
|
|
|
3109
3128
|
|
|
@@ -3177,7 +3196,7 @@
|
|
|
3177
3196
|
* Update chart summary.
|
|
3178
3197
|
*/
|
|
3179
3198
|
_updateSummary: function _updateSummary() {
|
|
3180
|
-
var
|
|
3199
|
+
var _this18 = this;
|
|
3181
3200
|
|
|
3182
3201
|
this._summary.reset();
|
|
3183
3202
|
|
|
@@ -3192,9 +3211,9 @@
|
|
|
3192
3211
|
select('.download a', this.summaryDiv).onclick = function (e) {
|
|
3193
3212
|
e.preventDefault();
|
|
3194
3213
|
|
|
3195
|
-
|
|
3196
|
-
downloadLink:
|
|
3197
|
-
confirm: saveFile.bind(
|
|
3214
|
+
_this18._fireEvt('eletrack_download', {
|
|
3215
|
+
downloadLink: _this18.options.downloadLink,
|
|
3216
|
+
confirm: saveFile.bind(_this18, _this18._downloadURL)
|
|
3198
3217
|
});
|
|
3199
3218
|
};
|
|
3200
3219
|
}
|
|
@@ -3258,7 +3277,7 @@
|
|
|
3258
3277
|
}
|
|
3259
3278
|
});
|
|
3260
3279
|
this.on('eledata_loaded', function (e) {
|
|
3261
|
-
var
|
|
3280
|
+
var _this19 = this;
|
|
3262
3281
|
|
|
3263
3282
|
var map = this._map;
|
|
3264
3283
|
var layer = e.layer;
|
|
@@ -3269,7 +3288,7 @@
|
|
|
3269
3288
|
}
|
|
3270
3289
|
|
|
3271
3290
|
map.once('layeradd', function (e) {
|
|
3272
|
-
return
|
|
3291
|
+
return _this19.options.autofitBounds && _this19.fitBounds(layer.getBounds());
|
|
3273
3292
|
});
|
|
3274
3293
|
|
|
3275
3294
|
if (L.Browser.mobile) {
|
|
@@ -3278,28 +3297,28 @@
|
|
|
3278
3297
|
// leaflet-geometryutil
|
|
3279
3298
|
Elevation._geomutilLazyLoader = lazyLoader(this.__LGEOMUTIL, typeof L.GeometryUtil !== 'function' || !this.options.lazyLoadJS, Elevation._geomutilLazyLoader).then(function () {
|
|
3280
3299
|
// leaflet-almostover
|
|
3281
|
-
if (
|
|
3282
|
-
Elevation._almostoverLazyLoader = lazyLoader(
|
|
3300
|
+
if (_this19.options.almostOver) {
|
|
3301
|
+
Elevation._almostoverLazyLoader = lazyLoader(_this19.__LALMOSTOVER, typeof L.Handler.AlmostOver !== 'function' || !_this19.options.lazyLoadJS, Elevation._almostoverLazyLoader).then(function () {
|
|
3283
3302
|
map.addHandler('almostOver', L.Handler.AlmostOver);
|
|
3284
3303
|
|
|
3285
3304
|
if (L.GeometryUtil && map.almostOver && map.almostOver.enabled()) {
|
|
3286
3305
|
map.almostOver.addLayer(layer);
|
|
3287
3306
|
map.on('almost:move', function (e) {
|
|
3288
|
-
return
|
|
3307
|
+
return _this19._mousemoveLayerHandler(e);
|
|
3289
3308
|
}).on('almost:out', function (e) {
|
|
3290
|
-
return
|
|
3309
|
+
return _this19._mouseoutHandler(e);
|
|
3291
3310
|
});
|
|
3292
3311
|
}
|
|
3293
3312
|
});
|
|
3294
3313
|
} // leaflet-distance-markers
|
|
3295
3314
|
|
|
3296
3315
|
|
|
3297
|
-
if (
|
|
3298
|
-
Elevation._distanceMarkersLazyLoader = lazyLoader(
|
|
3299
|
-
return
|
|
3316
|
+
if (_this19.options.distanceMarkers) {
|
|
3317
|
+
Elevation._distanceMarkersLazyLoader = lazyLoader(_this19.__LDISTANCEM, typeof L.DistanceMarkers !== 'function' || !_this19.options.lazyLoadJS, Elevation._distanceMarkersLazyLoader).then(function () {
|
|
3318
|
+
return _this19.options.polyline && layer.addTo(map);
|
|
3300
3319
|
});
|
|
3301
3320
|
} else {
|
|
3302
|
-
if (
|
|
3321
|
+
if (_this19.options.polyline) layer.addTo(map);
|
|
3303
3322
|
}
|
|
3304
3323
|
});
|
|
3305
3324
|
}
|