@raruto/leaflet-elevation 1.8.5 → 1.8.8
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 +2 -2
- package/dist/leaflet-elevation.js +127 -126
- package/dist/leaflet-elevation.js.map +1 -1
- package/dist/leaflet-elevation.min.js +2 -2
- package/dist/leaflet-elevation.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components.js +1 -1
- package/src/control.js +70 -66
- package/src/index.js +10 -8
- package/libs/extended-ui.js +0 -107
- package/libs/extended-ui.min.js +0 -5
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ _For a working example see one of the following demos:_
|
|
|
23
23
|
|
|
24
24
|
<br/>
|
|
25
25
|
|
|
26
|
+
- [custom chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_extended-ui.html)
|
|
26
27
|
- [custom colors](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
|
|
27
28
|
- [custom summary](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-summary.html)
|
|
28
29
|
- [close button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_close-button.html)
|
|
@@ -48,7 +49,6 @@ _For a working example see one of the following demos:_
|
|
|
48
49
|
- [almost over](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_almost-over.html)
|
|
49
50
|
- [follow marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_follow-marker.html)
|
|
50
51
|
- [dynamic runner](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_dynamic-runner.html)
|
|
51
|
-
- [extended ui](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_extended-ui.html)
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
@@ -258,7 +258,7 @@ _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Inte
|
|
|
258
258
|
**Compatibile with:**
|
|
259
259
|
[](http://leafletjs.com/reference.html)
|
|
260
260
|
[](https://www.npmjs.com/package/d3)
|
|
261
|
-
[](https://www.npmjs.com/package/@tmcw/togeojson)
|
|
262
262
|
|
|
263
263
|
|
|
264
264
|
---
|
|
@@ -675,8 +675,8 @@
|
|
|
675
675
|
var panes = {
|
|
676
676
|
grid: g.append("g").attr("class", "grid"),
|
|
677
677
|
area: g.append('g').attr("class", "area"),
|
|
678
|
-
point: g.append('g').attr("class", "point"),
|
|
679
678
|
axis: g.append('g').attr("class", "axis"),
|
|
679
|
+
point: g.append('g').attr("class", "point"),
|
|
680
680
|
brush: g.append("g").attr("class", "brush"),
|
|
681
681
|
tooltip: g.append("g").attr("class", "tooltip").attr('display', 'none'),
|
|
682
682
|
ruler: g.append('g').attr('class', 'ruler'),
|
|
@@ -1790,10 +1790,10 @@
|
|
|
1790
1790
|
__mileFactor: 0.621371,
|
|
1791
1791
|
__footFactor: 3.28084,
|
|
1792
1792
|
__D3: 'https://unpkg.com/d3@6.5.0/dist/d3.min.js',
|
|
1793
|
-
__TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.
|
|
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.
|
|
1796
|
+
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.8.8/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
|
|
@@ -2110,6 +2110,10 @@
|
|
|
2110
2110
|
if (!d) {
|
|
2111
2111
|
return;
|
|
2112
2112
|
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Standard GeoJSON --> doesn't handle "time", "heart", …
|
|
2115
|
+
*/
|
|
2116
|
+
|
|
2113
2117
|
|
|
2114
2118
|
var geom = d.geometry;
|
|
2115
2119
|
|
|
@@ -2137,47 +2141,47 @@
|
|
|
2137
2141
|
return _this5._addData(feature);
|
|
2138
2142
|
});
|
|
2139
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Extended GeoJSON --> rely on leaflet implementation
|
|
2146
|
+
*/
|
|
2147
|
+
|
|
2140
2148
|
|
|
2141
2149
|
if (d._latlngs) {
|
|
2142
|
-
this.
|
|
2150
|
+
this._addGeoJSONData(d._latlngs, d.feature && d.feature.properties);
|
|
2143
2151
|
}
|
|
2144
2152
|
},
|
|
2145
2153
|
|
|
2146
2154
|
/*
|
|
2147
2155
|
* Parsing of GeoJSON data lines and their elevation in z-coordinate
|
|
2148
2156
|
*/
|
|
2149
|
-
_addGeoJSONData: function _addGeoJSONData(coords) {
|
|
2157
|
+
_addGeoJSONData: function _addGeoJSONData(coords, properties) {
|
|
2150
2158
|
var _this6 = this;
|
|
2151
2159
|
|
|
2152
|
-
|
|
2153
|
-
|
|
2160
|
+
coords.forEach(function (point, i) {
|
|
2161
|
+
var _point$meta, _point$lat, _point$lng, _ref, _point$alt;
|
|
2154
2162
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2163
|
+
// Inspired by L.GPX layer properties
|
|
2164
|
+
point.meta = (_point$meta = point.meta) !== null && _point$meta !== void 0 ? _point$meta : {
|
|
2165
|
+
time: null,
|
|
2166
|
+
ele: null,
|
|
2167
|
+
hr: null,
|
|
2168
|
+
cad: null,
|
|
2169
|
+
atemp: null
|
|
2170
|
+
}; // "alt" property is generated inside "leaflet"
|
|
2160
2171
|
|
|
2161
|
-
|
|
2162
|
-
coords: coords,
|
|
2163
|
-
index: this._data.length - 1
|
|
2164
|
-
});
|
|
2165
|
-
},
|
|
2166
|
-
|
|
2167
|
-
/*
|
|
2168
|
-
* Parsing function for GPX data and their elevation in z-coordinate
|
|
2169
|
-
*/
|
|
2170
|
-
_addGPXData: function _addGPXData(coords) {
|
|
2171
|
-
var _this7 = this;
|
|
2172
|
+
if ("alt" in point) point.meta.ele = point.alt; // "coordinateProperties" property is generated inside "@tmcw/toGeoJSON"
|
|
2172
2173
|
|
|
2173
|
-
|
|
2174
|
-
|
|
2174
|
+
if (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
|
|
2178
|
+
}
|
|
2175
2179
|
|
|
2176
|
-
|
|
2180
|
+
_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]);
|
|
2177
2181
|
|
|
2178
|
-
|
|
2182
|
+
_this6._fireEvt("elepoint_added", {
|
|
2179
2183
|
point: point,
|
|
2180
|
-
index:
|
|
2184
|
+
index: _this6._data.length - 1
|
|
2181
2185
|
});
|
|
2182
2186
|
});
|
|
2183
2187
|
|
|
@@ -2192,9 +2196,9 @@
|
|
|
2192
2196
|
*/
|
|
2193
2197
|
_addPoint: function _addPoint(x, y, z) {
|
|
2194
2198
|
if (this.options.reverseCoords) {
|
|
2195
|
-
var
|
|
2196
|
-
x =
|
|
2197
|
-
y =
|
|
2199
|
+
var _ref2 = [y, x];
|
|
2200
|
+
x = _ref2[0];
|
|
2201
|
+
y = _ref2[1];
|
|
2198
2202
|
}
|
|
2199
2203
|
|
|
2200
2204
|
this._data.push({
|
|
@@ -2237,35 +2241,43 @@
|
|
|
2237
2241
|
}
|
|
2238
2242
|
}
|
|
2239
2243
|
},
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Initialize "L.AlmostOver" integration
|
|
2247
|
+
*/
|
|
2240
2248
|
_initAlmostOverHandler: function _initAlmostOverHandler(map, layer) {
|
|
2241
|
-
var
|
|
2249
|
+
var _this7 = this;
|
|
2242
2250
|
|
|
2243
2251
|
if (!map || !this.options.almostOver) return;
|
|
2244
2252
|
this.lazyLoad(this.__LGEOMUTIL).then(function () {
|
|
2245
|
-
return
|
|
2253
|
+
return _this7.lazyLoad(_this7.__LALMOSTOVER);
|
|
2246
2254
|
}).then(function () {
|
|
2247
2255
|
map.addHandler('almostOver', L.Handler.AlmostOver);
|
|
2248
2256
|
|
|
2249
2257
|
if (L.GeometryUtil && map.almostOver && map.almostOver.enabled()) {
|
|
2250
2258
|
map.almostOver.addLayer(layer);
|
|
2251
2259
|
map.on('almost:move', function (e) {
|
|
2252
|
-
return
|
|
2260
|
+
return _this7._mousemoveLayerHandler(e);
|
|
2253
2261
|
}).on('almost:out', function (e) {
|
|
2254
|
-
return
|
|
2262
|
+
return _this7._mouseoutHandler(e);
|
|
2255
2263
|
});
|
|
2256
2264
|
}
|
|
2257
2265
|
});
|
|
2258
2266
|
},
|
|
2267
|
+
|
|
2268
|
+
/**
|
|
2269
|
+
* Initialize "L.DistanceMarkers" integration
|
|
2270
|
+
*/
|
|
2259
2271
|
_initDistanceMarkers: function _initDistanceMarkers(map, layer) {
|
|
2260
|
-
var
|
|
2272
|
+
var _this8 = this;
|
|
2261
2273
|
|
|
2262
2274
|
if (!map) return;
|
|
2263
2275
|
|
|
2264
2276
|
if (this.options.distanceMarkers) {
|
|
2265
2277
|
this.lazyLoad(this.__LGEOMUTIL).then(function () {
|
|
2266
|
-
return
|
|
2278
|
+
return _this8.lazyLoad(_this8.__LDISTANCEM);
|
|
2267
2279
|
}).then(function () {
|
|
2268
|
-
return
|
|
2280
|
+
return _this8.options.polyline && layer.addTo(map);
|
|
2269
2281
|
});
|
|
2270
2282
|
} else if (this.options.polyline) {
|
|
2271
2283
|
layer.addTo(map);
|
|
@@ -2292,6 +2304,29 @@
|
|
|
2292
2304
|
return this.eleDiv = eleDiv;
|
|
2293
2305
|
},
|
|
2294
2306
|
|
|
2307
|
+
/**
|
|
2308
|
+
* Initialize "L.AlmostOver" and "L.DistanceMarkers"
|
|
2309
|
+
*/
|
|
2310
|
+
_initMapIntegrations: function _initMapIntegrations(control, layer) {
|
|
2311
|
+
var map = control._map;
|
|
2312
|
+
|
|
2313
|
+
if (control._map) {
|
|
2314
|
+
map.once('layeradd', function (e) {
|
|
2315
|
+
return control.options.autofitBounds && control.fitBounds(layer.getBounds());
|
|
2316
|
+
});
|
|
2317
|
+
|
|
2318
|
+
if (!L.Browser.mobile) {
|
|
2319
|
+
control._initAlmostOverHandler(map, layer);
|
|
2320
|
+
|
|
2321
|
+
control._initDistanceMarkers(map, layer);
|
|
2322
|
+
} else if (control.options.polyline) {
|
|
2323
|
+
layer.addTo(map);
|
|
2324
|
+
}
|
|
2325
|
+
} else {
|
|
2326
|
+
console.warn("Undefined elevation map object");
|
|
2327
|
+
}
|
|
2328
|
+
},
|
|
2329
|
+
|
|
2295
2330
|
/*
|
|
2296
2331
|
* Collapse current chart control.
|
|
2297
2332
|
*/
|
|
@@ -2343,17 +2378,17 @@
|
|
|
2343
2378
|
* @link https://github.com/Raruto/leaflet-elevation/issues/81#issuecomment-713477050
|
|
2344
2379
|
*/
|
|
2345
2380
|
_fixTooltipSize: function _fixTooltipSize() {
|
|
2346
|
-
var
|
|
2381
|
+
var _this9 = this;
|
|
2347
2382
|
|
|
2348
2383
|
this.on('elechart_init', function () {
|
|
2349
|
-
return
|
|
2350
|
-
if (
|
|
2351
|
-
|
|
2384
|
+
return _this9.once('elechart_change elechart_hover', function (e) {
|
|
2385
|
+
if (_this9._chartEnabled) {
|
|
2386
|
+
_this9._chart._showDiagramIndicator(e.data, e.xCoord);
|
|
2352
2387
|
|
|
2353
|
-
|
|
2388
|
+
_this9._chart._showDiagramIndicator(e.data, e.xCoord);
|
|
2354
2389
|
}
|
|
2355
2390
|
|
|
2356
|
-
|
|
2391
|
+
_this9._updateMarker(e.data);
|
|
2357
2392
|
});
|
|
2358
2393
|
});
|
|
2359
2394
|
},
|
|
@@ -2434,17 +2469,17 @@
|
|
|
2434
2469
|
this._fireEvt("elechart_init");
|
|
2435
2470
|
},
|
|
2436
2471
|
_initLayer: function _initLayer() {
|
|
2437
|
-
var
|
|
2472
|
+
var _this10 = this;
|
|
2438
2473
|
|
|
2439
2474
|
this._layers.on('layeradd layerremove', function (e) {
|
|
2440
2475
|
var layer = e.layer;
|
|
2441
2476
|
var node = layer.getElement && layer.getElement();
|
|
2442
2477
|
|
|
2443
|
-
toggleClass(node,
|
|
2478
|
+
toggleClass(node, _this10.options.polyline.className + ' ' + _this10.options.theme, e.type == 'layeradd');
|
|
2444
2479
|
|
|
2445
|
-
toggleEvent(layer, "mousemove",
|
|
2480
|
+
toggleEvent(layer, "mousemove", _this10._mousemoveLayerHandler.bind(_this10), e.type == 'layeradd');
|
|
2446
2481
|
|
|
2447
|
-
toggleEvent(layer, "mouseout",
|
|
2482
|
+
toggleEvent(layer, "mouseout", _this10._mouseoutHandler.bind(_this10), e.type == 'layeradd');
|
|
2448
2483
|
});
|
|
2449
2484
|
},
|
|
2450
2485
|
_initMarker: function _initMarker(map) {
|
|
@@ -2516,14 +2551,16 @@
|
|
|
2516
2551
|
* Retrieve data from a remote url (HTTP).
|
|
2517
2552
|
*/
|
|
2518
2553
|
_loadFile: function _loadFile(url) {
|
|
2519
|
-
var
|
|
2554
|
+
var _this11 = this;
|
|
2520
2555
|
|
|
2521
2556
|
fetch(url).then(function (response) {
|
|
2522
2557
|
return response.text();
|
|
2523
2558
|
}).then(function (data) {
|
|
2524
|
-
|
|
2559
|
+
_this11._downloadURL = url; // TODO: handle multiple urls?
|
|
2525
2560
|
|
|
2526
|
-
|
|
2561
|
+
_this11._parseFromString(data).then(function (geojson) {
|
|
2562
|
+
return geojson && _this11._loadLayer(geojson);
|
|
2563
|
+
});
|
|
2527
2564
|
}).catch(function (err) {
|
|
2528
2565
|
return console.warn(err);
|
|
2529
2566
|
});
|
|
@@ -2594,53 +2631,16 @@
|
|
|
2594
2631
|
}
|
|
2595
2632
|
},
|
|
2596
2633
|
onEachFeature: function onEachFeature(feature, layer) {
|
|
2597
|
-
if (feature.geometry && feature.geometry.type
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
point.meta = {
|
|
2604
|
-
time: null,
|
|
2605
|
-
ele: null,
|
|
2606
|
-
hr: null,
|
|
2607
|
-
cad: null,
|
|
2608
|
-
atemp: null
|
|
2609
|
-
};
|
|
2610
|
-
if ("alt" in point) point.meta.ele = point.alt;
|
|
2611
|
-
|
|
2612
|
-
if (feature.properties) {
|
|
2613
|
-
var prop = feature.properties;
|
|
2614
|
-
if ("coordTimes" in prop) point.meta.time = new Date(Date.parse(prop.coordTimes[i]));else if ("times" in prop) point.meta.time = new Date(Date.parse(prop.times[i]));else if ("time" in prop) point.meta.time = new Date(Date.parse(_typeof(prop.time) === 'object' ? prop.time[i] : prop.time));
|
|
2615
|
-
if ("heartRates" in prop) point.meta.hr = parseInt(prop.heartRates[i]);else if ("heartRate" in prop) point.meta.hr = parseInt(_typeof(prop.heartRate) === 'object' ? prop.heartRate[i] : prop.heartRate); // TODO: cadence, temperature
|
|
2616
|
-
}
|
|
2617
|
-
});
|
|
2618
|
-
|
|
2619
|
-
control.addData(layer); // NB make use of "_addGPXData"
|
|
2620
|
-
|
|
2621
|
-
control.track_info = L.extend({}, control.track_info, {
|
|
2622
|
-
name: geojson.name
|
|
2623
|
-
});
|
|
2634
|
+
if (feature.geometry && feature.geometry.type != 'Point') {
|
|
2635
|
+
control.addData(layer);
|
|
2636
|
+
control.track_info = L.extend({}, control.track_info, {
|
|
2637
|
+
name: geojson.name
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2624
2640
|
}
|
|
2625
2641
|
});
|
|
2626
2642
|
control.lazyLoad(control.__D3).then(function () {
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
if (map) {
|
|
2630
|
-
map.once('layeradd', function (e) {
|
|
2631
|
-
return control.options.autofitBounds && control.fitBounds(layer.getBounds());
|
|
2632
|
-
});
|
|
2633
|
-
|
|
2634
|
-
if (!L.Browser.mobile) {
|
|
2635
|
-
control._initAlmostOverHandler(map, layer);
|
|
2636
|
-
|
|
2637
|
-
control._initDistanceMarkers(map, layer);
|
|
2638
|
-
} else if (control.options.polyline) {
|
|
2639
|
-
layer.addTo(map);
|
|
2640
|
-
}
|
|
2641
|
-
} else {
|
|
2642
|
-
console.warn("Undefined elevation map object");
|
|
2643
|
-
}
|
|
2643
|
+
control._initMapIntegrations(control, layer);
|
|
2644
2644
|
|
|
2645
2645
|
control._fireEvt("eledata_loaded", {
|
|
2646
2646
|
data: geojson,
|
|
@@ -2746,21 +2746,21 @@
|
|
|
2746
2746
|
* Attempt to parse raw response data (GeoJSON or XML > GeoJSON)
|
|
2747
2747
|
*/
|
|
2748
2748
|
_parseFromString: function _parseFromString(data) {
|
|
2749
|
-
var
|
|
2749
|
+
var _this12 = this;
|
|
2750
2750
|
|
|
2751
2751
|
return new Promise(function (resolve) {
|
|
2752
|
-
return
|
|
2752
|
+
return _this12.lazyLoad(_this12.__TOGEOJSON).then(function () {
|
|
2753
2753
|
var geojson;
|
|
2754
2754
|
|
|
2755
2755
|
try {
|
|
2756
|
-
geojson =
|
|
2756
|
+
geojson = _this12._parseFromXMLString(data.trim());
|
|
2757
2757
|
} catch (e) {
|
|
2758
|
-
geojson =
|
|
2758
|
+
geojson = _this12._parseFromGeoJSONString(data.toString());
|
|
2759
2759
|
}
|
|
2760
2760
|
|
|
2761
2761
|
if (geojson) {
|
|
2762
|
-
geojson =
|
|
2763
|
-
geojson =
|
|
2762
|
+
geojson = _this12._prepareMultiLineStrings(geojson);
|
|
2763
|
+
geojson = _this12._prepareAdditionalProperties(geojson);
|
|
2764
2764
|
}
|
|
2765
2765
|
|
|
2766
2766
|
resolve(geojson);
|
|
@@ -2772,6 +2772,8 @@
|
|
|
2772
2772
|
* Simple XML Parser (GPX, KML, TCX)
|
|
2773
2773
|
*/
|
|
2774
2774
|
_parseFromXMLString: function _parseFromXMLString(data) {
|
|
2775
|
+
var _Array$from$find;
|
|
2776
|
+
|
|
2775
2777
|
if (data.indexOf("<") != 0) {
|
|
2776
2778
|
throw 'Invalid XML';
|
|
2777
2779
|
}
|
|
@@ -2790,9 +2792,9 @@
|
|
|
2790
2792
|
}
|
|
2791
2793
|
|
|
2792
2794
|
var geojson = toGeoJSON[type](xml);
|
|
2793
|
-
geojson.name = name.length > 0 ? Array.from(name).find(function (tag) {
|
|
2795
|
+
geojson.name = name.length > 0 ? ((_Array$from$find = Array.from(name).find(function (tag) {
|
|
2794
2796
|
return tag.parentElement.tagName == "trk";
|
|
2795
|
-
}).textContent : '';
|
|
2797
|
+
})) !== null && _Array$from$find !== void 0 ? _Array$from$find : name[0]).textContent : '';
|
|
2796
2798
|
return geojson;
|
|
2797
2799
|
},
|
|
2798
2800
|
|
|
@@ -2837,10 +2839,10 @@
|
|
|
2837
2839
|
* Add a point of interest over the diagram
|
|
2838
2840
|
*/
|
|
2839
2841
|
_registerCheckPoint: function _registerCheckPoint(props) {
|
|
2840
|
-
var
|
|
2842
|
+
var _this13 = this;
|
|
2841
2843
|
|
|
2842
2844
|
this.on("elechart_updated", function () {
|
|
2843
|
-
return
|
|
2845
|
+
return _this13._chart._registerCheckPoint(props);
|
|
2844
2846
|
});
|
|
2845
2847
|
},
|
|
2846
2848
|
|
|
@@ -2848,10 +2850,10 @@
|
|
|
2848
2850
|
* Add chart profile to diagram
|
|
2849
2851
|
*/
|
|
2850
2852
|
_registerAreaPath: function _registerAreaPath(props) {
|
|
2851
|
-
var
|
|
2853
|
+
var _this14 = this;
|
|
2852
2854
|
|
|
2853
2855
|
this.on("elechart_init", function () {
|
|
2854
|
-
return
|
|
2856
|
+
return _this14._chart._registerAreaPath(props);
|
|
2855
2857
|
});
|
|
2856
2858
|
},
|
|
2857
2859
|
|
|
@@ -2859,10 +2861,10 @@
|
|
|
2859
2861
|
* Add chart grid to diagram
|
|
2860
2862
|
*/
|
|
2861
2863
|
_registerAxisGrid: function _registerAxisGrid(props) {
|
|
2862
|
-
var
|
|
2864
|
+
var _this15 = this;
|
|
2863
2865
|
|
|
2864
2866
|
this.on("elechart_axis", function () {
|
|
2865
|
-
return
|
|
2867
|
+
return _this15._chart._registerAxisGrid(props);
|
|
2866
2868
|
});
|
|
2867
2869
|
},
|
|
2868
2870
|
|
|
@@ -2870,10 +2872,10 @@
|
|
|
2870
2872
|
* Add chart axis to diagram
|
|
2871
2873
|
*/
|
|
2872
2874
|
_registerAxisScale: function _registerAxisScale(props) {
|
|
2873
|
-
var
|
|
2875
|
+
var _this16 = this;
|
|
2874
2876
|
|
|
2875
2877
|
this.on("elechart_axis", function () {
|
|
2876
|
-
return
|
|
2878
|
+
return _this16._chart._registerAxisScale(props);
|
|
2877
2879
|
});
|
|
2878
2880
|
},
|
|
2879
2881
|
|
|
@@ -2881,14 +2883,14 @@
|
|
|
2881
2883
|
* Add chart or marker tooltip info
|
|
2882
2884
|
*/
|
|
2883
2885
|
_registerTooltip: function _registerTooltip(props) {
|
|
2884
|
-
var
|
|
2886
|
+
var _this17 = this;
|
|
2885
2887
|
|
|
2886
2888
|
if (props.chart) {
|
|
2887
2889
|
var label = L.extend({}, props, {
|
|
2888
2890
|
value: props.chart
|
|
2889
2891
|
});
|
|
2890
2892
|
this.on("elechart_init", function () {
|
|
2891
|
-
return
|
|
2893
|
+
return _this17._chart._registerTooltip(label);
|
|
2892
2894
|
});
|
|
2893
2895
|
}
|
|
2894
2896
|
|
|
@@ -2898,7 +2900,7 @@
|
|
|
2898
2900
|
});
|
|
2899
2901
|
|
|
2900
2902
|
this.on("elechart_marker", function () {
|
|
2901
|
-
return
|
|
2903
|
+
return _this17._marker._registerTooltip(_label);
|
|
2902
2904
|
});
|
|
2903
2905
|
}
|
|
2904
2906
|
},
|
|
@@ -2907,10 +2909,10 @@
|
|
|
2907
2909
|
* Add summary info to diagram
|
|
2908
2910
|
*/
|
|
2909
2911
|
_registerSummary: function _registerSummary(props) {
|
|
2910
|
-
var
|
|
2912
|
+
var _this18 = this;
|
|
2911
2913
|
|
|
2912
2914
|
this.on('elechart_summary', function () {
|
|
2913
|
-
return
|
|
2915
|
+
return _this18._summary._registerSummary(props);
|
|
2914
2916
|
});
|
|
2915
2917
|
},
|
|
2916
2918
|
|
|
@@ -3015,17 +3017,14 @@
|
|
|
3015
3017
|
* Toggle chart data on legend click
|
|
3016
3018
|
*/
|
|
3017
3019
|
_toggleChartHandler: function _toggleChartHandler(e) {
|
|
3018
|
-
var
|
|
3020
|
+
var _this19 = this;
|
|
3019
3021
|
|
|
3020
|
-
var
|
|
3021
|
-
name = e.name,
|
|
3022
|
+
var name = e.name,
|
|
3022
3023
|
enabled = e.enabled;
|
|
3023
3024
|
this._chartEnabled = this._chart._hasActiveLayers(); // toggle layer visibility on empty chart
|
|
3024
3025
|
|
|
3025
3026
|
this._layers.eachLayer(function (layer) {
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
toggleClass(node, _this20.options.polyline.className + ' ' + _this20.options.theme, _this20._chartEnabled);
|
|
3027
|
+
return toggleClass(layer.getElement && layer.getElement(), _this19.options.polyline.className + ' ' + _this19.options.theme, _this19._chartEnabled);
|
|
3029
3028
|
}); // toggle option value (eg. altitude = { 'disabled' || 'disabled' })
|
|
3030
3029
|
|
|
3031
3030
|
|
|
@@ -3099,7 +3098,7 @@
|
|
|
3099
3098
|
* Update chart summary.
|
|
3100
3099
|
*/
|
|
3101
3100
|
_updateSummary: function _updateSummary() {
|
|
3102
|
-
var
|
|
3101
|
+
var _this20 = this;
|
|
3103
3102
|
|
|
3104
3103
|
this._summary.reset();
|
|
3105
3104
|
|
|
@@ -3122,9 +3121,9 @@
|
|
|
3122
3121
|
e.confirm();
|
|
3123
3122
|
}
|
|
3124
3123
|
|
|
3125
|
-
|
|
3126
|
-
downloadLink:
|
|
3127
|
-
confirm: saveFile.bind(
|
|
3124
|
+
_this20._fireEvt('eletrack_download', {
|
|
3125
|
+
downloadLink: _this20.options.downloadLink,
|
|
3126
|
+
confirm: saveFile.bind(_this20, _this20._downloadURL)
|
|
3128
3127
|
});
|
|
3129
3128
|
};
|
|
3130
3129
|
}
|
|
@@ -3847,6 +3846,8 @@
|
|
|
3847
3846
|
this.loadGeoJSON = this.load;
|
|
3848
3847
|
this.loadXML = this.load;
|
|
3849
3848
|
this.loadFile = this.load;
|
|
3849
|
+
this._addGPXData = this._addGeoJSONData;
|
|
3850
|
+
this._registerFocusLabel = this._registerTooltip;
|
|
3850
3851
|
});
|
|
3851
3852
|
|
|
3852
3853
|
L.control.elevation = function (options) {
|