@raruto/leaflet-elevation 1.7.2 → 1.7.6
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 +9 -3
- package/dist/leaflet-elevation.js +273 -233
- package/dist/leaflet-elevation.js.map +1 -1
- package/dist/leaflet-elevation.min.js +3 -1
- package/dist/leaflet-elevation.min.js.map +1 -1
- package/libs/leaflet-gpxgroup.js +48 -39
- package/libs/leaflet-gpxgroup.min.js +14 -13
- package/package.json +1 -1
- package/src/acceleration.js +1 -1
- package/src/altitude.js +6 -0
- package/src/chart.js +3 -24
- package/src/components.js +36 -24
- package/src/control.js +10 -6
- package/src/distance.js +5 -0
- package/src/index.js +12 -1
- package/src/marker.js +3 -20
- package/src/options.js +2 -0
- package/src/slope.js +1 -1
- package/src/speed.js +2 -2
- package/src/time.js +9 -4
- package/src/utils.js +37 -25
|
@@ -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
|
|
@@ -680,12 +690,25 @@
|
|
|
680
690
|
xCoord = _ref5$xCoord === void 0 ? 0 : _ref5$xCoord,
|
|
681
691
|
_ref5$yCoord = _ref5.yCoord,
|
|
682
692
|
yCoord = _ref5$yCoord === void 0 ? 0 : _ref5$yCoord,
|
|
683
|
-
|
|
693
|
+
_ref5$labels = _ref5.labels,
|
|
694
|
+
labels = _ref5$labels === void 0 ? {} : _ref5$labels,
|
|
695
|
+
_ref5$item = _ref5.item,
|
|
696
|
+
item = _ref5$item === void 0 ? {} : _ref5$item;
|
|
684
697
|
return function (text) {
|
|
685
698
|
text.attr("class", theme + " height-focus-label").style("pointer-events", "none").attr("x", xCoord + 5).attr("y", yCoord);
|
|
686
|
-
var
|
|
687
|
-
|
|
688
|
-
|
|
699
|
+
var label;
|
|
700
|
+
|
|
701
|
+
for (var i in labels) {
|
|
702
|
+
label = text.select(".height-focus-" + labels[i].name);
|
|
703
|
+
|
|
704
|
+
if (!label.size()) {
|
|
705
|
+
label = text.append("svg:tspan").attr("class", "height-focus-" + labels[i].name).attr("dy", "1.5em");
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
label.text(typeof labels[i].value !== "function" ? labels[i].value : labels[i].value(item));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
text.select('tspan').attr("dy", text.selectAll('tspan').size() > 1 ? "-1.5em" : "0em");
|
|
689
712
|
text.selectAll('tspan').attr("x", xCoord + 5);
|
|
690
713
|
return text;
|
|
691
714
|
};
|
|
@@ -738,23 +761,17 @@
|
|
|
738
761
|
var MouseFocusLabel = function MouseFocusLabel(_ref9) {
|
|
739
762
|
var xCoord = _ref9.xCoord,
|
|
740
763
|
yCoord = _ref9.yCoord,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
_ref9$
|
|
744
|
-
|
|
745
|
-
|
|
764
|
+
width = _ref9.width,
|
|
765
|
+
_ref9$labels = _ref9.labels,
|
|
766
|
+
labels = _ref9$labels === void 0 ? {} : _ref9$labels,
|
|
767
|
+
_ref9$item = _ref9.item,
|
|
768
|
+
item = _ref9$item === void 0 ? {} : _ref9$item;
|
|
746
769
|
return function (g) {
|
|
747
770
|
g.attr('class', 'mouse-focus-label');
|
|
748
771
|
var rect = g.select(".mouse-focus-label-rect");
|
|
749
772
|
var text = g.select(".mouse-focus-label-text");
|
|
750
|
-
var y = text.select(".mouse-focus-label-y");
|
|
751
|
-
var x = text.select(".mouse-focus-label-x");
|
|
752
773
|
if (!rect.node()) rect = g.append("svg:rect");
|
|
753
|
-
if (!text.node()) text = g.append("svg:text");
|
|
754
|
-
if (!y.node()) y = text.append("svg:tspan");
|
|
755
|
-
if (!x.node()) x = text.append("svg:tspan");
|
|
756
|
-
y.text(labelY);
|
|
757
|
-
x.text(labelX); // Sets focus-label-text position to the left / right of the mouse-focus-line
|
|
774
|
+
if (!text.node()) text = g.append("svg:text"); // Sets focus-label-text position to the left / right of the mouse-focus-line
|
|
758
775
|
|
|
759
776
|
var xAlign = 0;
|
|
760
777
|
var yAlign = 0;
|
|
@@ -773,8 +790,19 @@
|
|
|
773
790
|
if (yCoord) yAlign = Math.max(yCoord - bbox.height, L.Browser.webkit ? 0 : -Infinity);
|
|
774
791
|
rect.attr("class", "mouse-focus-label-rect").attr("x", xAlign - 5).attr("y", yAlign - 5).attr("width", bbox.width + 10).attr("height", bbox.height + 10).attr("rx", 3).attr("ry", 3);
|
|
775
792
|
text.attr("class", "mouse-focus-label-text").style("font-weight", "700").attr("y", yAlign);
|
|
776
|
-
|
|
777
|
-
|
|
793
|
+
var label;
|
|
794
|
+
|
|
795
|
+
for (var i in labels) {
|
|
796
|
+
label = text.select(".mouse-focus-label-" + labels[i].name);
|
|
797
|
+
|
|
798
|
+
if (!label.size()) {
|
|
799
|
+
label = text.append("svg:tspan", ".mouse-focus-label-x").attr("class", "mouse-focus-label-" + labels[i].name).attr("dy", "1.5em");
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
label.text(typeof labels[i].value !== "function" ? labels[i].value : labels[i].value(item));
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
text.select('tspan').attr("dy", "1em");
|
|
778
806
|
text.selectAll('tspan').attr("x", xAlign);
|
|
779
807
|
return g;
|
|
780
808
|
};
|
|
@@ -928,8 +956,9 @@
|
|
|
928
956
|
yCoord: 0,
|
|
929
957
|
height: _height,
|
|
930
958
|
width: _width,
|
|
931
|
-
labelX: "",
|
|
932
|
-
labelY: ""
|
|
959
|
+
labels: {} // labelX: "",
|
|
960
|
+
// labelY: "",
|
|
961
|
+
|
|
933
962
|
})); // Add the brushing
|
|
934
963
|
|
|
935
964
|
var brush = d3.brushX().on('start.cursor end.cursor brush.cursor', function () {
|
|
@@ -1797,28 +1826,9 @@
|
|
|
1797
1826
|
yCoord: yCoordinate,
|
|
1798
1827
|
height: this._height(),
|
|
1799
1828
|
width: this._width(),
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
}));
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
var labels = this._props.focusLabels;
|
|
1806
|
-
|
|
1807
|
-
var tooltip = this._focuslabel.select('text');
|
|
1808
|
-
|
|
1809
|
-
var label;
|
|
1810
|
-
|
|
1811
|
-
for (var i in labels) {
|
|
1812
|
-
label = tooltip.select(".mouse-focus-label-" + labels[i].name);
|
|
1813
|
-
|
|
1814
|
-
if (!label.size()) {
|
|
1815
|
-
label = tooltip.append("svg:tspan", ".mouse-focus-label-x").attr("class", "mouse-focus-label-" + labels[i].name).attr("dy", "1.5em");
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
label.text(typeof labels[i].value !== "function" ? labels[i].value : labels[i].value(item));
|
|
1819
|
-
|
|
1820
|
-
this._focuslabel.select('.mouse-focus-label-x').attr("dy", "1.5em");
|
|
1821
|
-
}
|
|
1829
|
+
labels: this._props.focusLabels,
|
|
1830
|
+
item: item
|
|
1831
|
+
}));
|
|
1822
1832
|
},
|
|
1823
1833
|
_hideDiagramIndicator: function _hideDiagramIndicator() {
|
|
1824
1834
|
this._focusG.attr("display", 'none');
|
|
@@ -1921,24 +1931,9 @@
|
|
|
1921
1931
|
theme: opts.theme,
|
|
1922
1932
|
xCoord: point.x,
|
|
1923
1933
|
yCoord: normalizedY,
|
|
1924
|
-
|
|
1934
|
+
labels: this._focuslabels,
|
|
1935
|
+
item: point
|
|
1925
1936
|
}));
|
|
1926
|
-
|
|
1927
|
-
var labels = this._focuslabels;
|
|
1928
|
-
var tooltip = this._focuslabel;
|
|
1929
|
-
var label;
|
|
1930
|
-
|
|
1931
|
-
for (var i in labels) {
|
|
1932
|
-
label = tooltip.select(".height-focus-" + labels[i].name);
|
|
1933
|
-
|
|
1934
|
-
if (!label.size()) {
|
|
1935
|
-
label = tooltip.append("svg:tspan").attr("class", "height-focus-" + labels[i].name).attr("dy", "1.5em");
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
label.text(typeof labels[i].value !== "function" ? labels[i].value : labels[i].value(props.item));
|
|
1939
|
-
|
|
1940
|
-
this._focuslabel.select('.height-focus-y').attr("dy", "-1.5em");
|
|
1941
|
-
}
|
|
1942
1937
|
} else if (this.options.marker == 'position-marker') {
|
|
1943
1938
|
removeClass(this._marker.getElement(), 'leaflet-hidden');
|
|
1944
1939
|
|
|
@@ -2074,6 +2069,7 @@
|
|
|
2074
2069
|
time: false,
|
|
2075
2070
|
timeFactor: 3600,
|
|
2076
2071
|
timeFormat: false,
|
|
2072
|
+
timestamps: false,
|
|
2077
2073
|
sDeltaMax: undefined,
|
|
2078
2074
|
sInterpolation: "curveStepAfter",
|
|
2079
2075
|
sRange: undefined,
|
|
@@ -2087,6 +2083,7 @@
|
|
|
2087
2083
|
iconAnchor: [8, 30]
|
|
2088
2084
|
})
|
|
2089
2085
|
},
|
|
2086
|
+
wptLabels: true,
|
|
2090
2087
|
xAttr: "dist",
|
|
2091
2088
|
xLabel: "km",
|
|
2092
2089
|
xTicks: undefined,
|
|
@@ -2108,7 +2105,7 @@
|
|
|
2108
2105
|
__TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.3.0/dist/togeojson.umd.js',
|
|
2109
2106
|
__LGEOMUTIL: 'https://unpkg.com/leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js',
|
|
2110
2107
|
__LALMOSTOVER: 'https://unpkg.com/leaflet-almostover@1.0.1/src/leaflet.almostover.js',
|
|
2111
|
-
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.7.
|
|
2108
|
+
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.7.5/libs/leaflet-distance-marker.min.js',
|
|
2112
2109
|
|
|
2113
2110
|
/*
|
|
2114
2111
|
* Add data to the diagram either from GPX or GeoJSON and update the axis domain and data
|
|
@@ -2116,7 +2113,7 @@
|
|
|
2116
2113
|
addData: function addData(d, layer) {
|
|
2117
2114
|
var _this = this;
|
|
2118
2115
|
|
|
2119
|
-
if (
|
|
2116
|
+
if (typeof layer === "undefined" && d.on) {
|
|
2120
2117
|
layer = d;
|
|
2121
2118
|
}
|
|
2122
2119
|
|
|
@@ -2166,9 +2163,11 @@
|
|
|
2166
2163
|
this._updateChart();
|
|
2167
2164
|
},
|
|
2168
2165
|
_clearChart: function _clearChart() {
|
|
2166
|
+
var _this2 = this;
|
|
2167
|
+
|
|
2169
2168
|
if (this._events && this._events.elechart_updated) {
|
|
2170
2169
|
this._events.elechart_updated.forEach(function (e) {
|
|
2171
|
-
return
|
|
2170
|
+
return _this2.off('elechart_updated', e.fn, e.ctx);
|
|
2172
2171
|
});
|
|
2173
2172
|
}
|
|
2174
2173
|
|
|
@@ -2293,9 +2292,10 @@
|
|
|
2293
2292
|
// this._updateChart = _.debounce(this._updateChart, 300, this);
|
|
2294
2293
|
// this._updateSummary = _.debounce(this._updateSummary, 300, this);
|
|
2295
2294
|
// }
|
|
2296
|
-
// Leaflet canvas renderer colors
|
|
2297
2295
|
|
|
2298
2296
|
|
|
2297
|
+
if (this.options.wptIcons === true) this.options.wptIcons = Options.wptIcons; // Leaflet canvas renderer colors
|
|
2298
|
+
|
|
2299
2299
|
L.extend(Colors, this.options.colors || {});
|
|
2300
2300
|
},
|
|
2301
2301
|
|
|
@@ -2346,14 +2346,14 @@
|
|
|
2346
2346
|
* Load data from a remote url.
|
|
2347
2347
|
*/
|
|
2348
2348
|
loadFile: function loadFile(url) {
|
|
2349
|
-
var
|
|
2349
|
+
var _this3 = this;
|
|
2350
2350
|
|
|
2351
2351
|
fetch(url).then(function (response) {
|
|
2352
2352
|
return response.text();
|
|
2353
2353
|
}).then(function (data) {
|
|
2354
|
-
|
|
2354
|
+
_this3._downloadURL = url; // TODO: handle multiple urls?
|
|
2355
2355
|
|
|
2356
|
-
|
|
2356
|
+
_this3.loadData(data, {
|
|
2357
2357
|
lazy: false,
|
|
2358
2358
|
defer: false
|
|
2359
2359
|
});
|
|
@@ -2380,7 +2380,7 @@
|
|
|
2380
2380
|
* Load raw XML data.
|
|
2381
2381
|
*/
|
|
2382
2382
|
loadXML: function loadXML(data) {
|
|
2383
|
-
var
|
|
2383
|
+
var _this4 = this;
|
|
2384
2384
|
|
|
2385
2385
|
Elevation._togeojsonLazyLoader = lazyLoader(this.__TOGEOJSON, typeof toGeoJSON !== 'function' || !this.options.lazyLoadJS, Elevation._togeojsonLazyLoader).then(function () {
|
|
2386
2386
|
var xml = new DOMParser().parseFromString(data, "text/xml");
|
|
@@ -2395,11 +2395,11 @@
|
|
|
2395
2395
|
|
|
2396
2396
|
if (name[0]) {
|
|
2397
2397
|
geojson.name = name[0].innerHTML;
|
|
2398
|
-
} else if (
|
|
2399
|
-
geojson.name =
|
|
2398
|
+
} else if (_this4._downloadURL) {
|
|
2399
|
+
geojson.name = _this4._downloadURL.split('/').pop().split('#')[0].split('?')[0];
|
|
2400
2400
|
}
|
|
2401
2401
|
|
|
2402
|
-
return
|
|
2402
|
+
return _this4.loadGeoJSON(geojson, _this4);
|
|
2403
2403
|
});
|
|
2404
2404
|
},
|
|
2405
2405
|
|
|
@@ -2407,7 +2407,7 @@
|
|
|
2407
2407
|
* Wait for chart container visible before download data.
|
|
2408
2408
|
*/
|
|
2409
2409
|
loadLazy: function loadLazy(data, opts) {
|
|
2410
|
-
var
|
|
2410
|
+
var _this5 = this;
|
|
2411
2411
|
|
|
2412
2412
|
opts = L.extend({}, this.options.loadData, opts);
|
|
2413
2413
|
var elem = opts.lazy.parentNode ? opts.lazy : this.placeholder;
|
|
@@ -2415,10 +2415,10 @@
|
|
|
2415
2415
|
waitHolder(elem).then(function () {
|
|
2416
2416
|
opts.lazy = false;
|
|
2417
2417
|
|
|
2418
|
-
|
|
2418
|
+
_this5.loadData(data, opts);
|
|
2419
2419
|
|
|
2420
|
-
|
|
2421
|
-
return
|
|
2420
|
+
_this5.once('eledata_loaded', function () {
|
|
2421
|
+
return _this5.placeholder.parentNode.removeChild(elem);
|
|
2422
2422
|
});
|
|
2423
2423
|
});
|
|
2424
2424
|
},
|
|
@@ -2428,7 +2428,7 @@
|
|
|
2428
2428
|
* Called on control.addTo(map).
|
|
2429
2429
|
*/
|
|
2430
2430
|
onAdd: function onAdd(map) {
|
|
2431
|
-
var
|
|
2431
|
+
var _this6 = this;
|
|
2432
2432
|
|
|
2433
2433
|
this._map = map;
|
|
2434
2434
|
|
|
@@ -2448,27 +2448,27 @@
|
|
|
2448
2448
|
}
|
|
2449
2449
|
|
|
2450
2450
|
Elevation._d3LazyLoader = lazyLoader(this.__D3, (typeof d3 === "undefined" ? "undefined" : _typeof(d3)) !== 'object' || !this.options.lazyLoadJS, Elevation._d3LazyLoader).then(function () {
|
|
2451
|
-
|
|
2451
|
+
_this6._initButton(container);
|
|
2452
2452
|
|
|
2453
|
-
|
|
2453
|
+
_this6._initChart(container);
|
|
2454
2454
|
|
|
2455
|
-
|
|
2455
|
+
_this6._initSummary(container);
|
|
2456
2456
|
|
|
2457
|
-
|
|
2457
|
+
_this6._initMarker(map);
|
|
2458
2458
|
|
|
2459
|
-
|
|
2459
|
+
_this6._initLayer(map);
|
|
2460
2460
|
|
|
2461
|
-
map.on('zoom viewreset zoomanim',
|
|
2461
|
+
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);
|
|
2462
2462
|
|
|
2463
|
-
on(map.getContainer(), 'mousewheel',
|
|
2463
|
+
on(map.getContainer(), 'mousewheel', _this6._resetDrag, _this6);
|
|
2464
2464
|
|
|
2465
|
-
on(map.getContainer(), 'touchstart',
|
|
2465
|
+
on(map.getContainer(), 'touchstart', _this6._resetDrag, _this6);
|
|
2466
2466
|
|
|
2467
|
-
|
|
2467
|
+
_this6.on('eledata_added eledata_loaded', _this6._updateChart, _this6).on('eledata_added eledata_loaded', _this6._updateSummary, _this6);
|
|
2468
2468
|
|
|
2469
|
-
|
|
2469
|
+
_this6._updateChart();
|
|
2470
2470
|
|
|
2471
|
-
|
|
2471
|
+
_this6._updateSummary();
|
|
2472
2472
|
});
|
|
2473
2473
|
return container;
|
|
2474
2474
|
},
|
|
@@ -2513,7 +2513,7 @@
|
|
|
2513
2513
|
* Parsing data either from GPX or GeoJSON and update the diagram data
|
|
2514
2514
|
*/
|
|
2515
2515
|
_addData: function _addData(d) {
|
|
2516
|
-
var
|
|
2516
|
+
var _this7 = this;
|
|
2517
2517
|
|
|
2518
2518
|
if (!d) {
|
|
2519
2519
|
return;
|
|
@@ -2530,7 +2530,7 @@
|
|
|
2530
2530
|
|
|
2531
2531
|
case 'MultiLineString':
|
|
2532
2532
|
each(geom.coordinates, function (coords) {
|
|
2533
|
-
return
|
|
2533
|
+
return _this7._addGeoJSONData(coords);
|
|
2534
2534
|
});
|
|
2535
2535
|
|
|
2536
2536
|
break;
|
|
@@ -2542,7 +2542,7 @@
|
|
|
2542
2542
|
|
|
2543
2543
|
if (d.type === "FeatureCollection") {
|
|
2544
2544
|
each(d.features, function (feature) {
|
|
2545
|
-
return
|
|
2545
|
+
return _this7._addData(feature);
|
|
2546
2546
|
});
|
|
2547
2547
|
}
|
|
2548
2548
|
|
|
@@ -2555,14 +2555,14 @@
|
|
|
2555
2555
|
* Parsing of GeoJSON data lines and their elevation in z-coordinate
|
|
2556
2556
|
*/
|
|
2557
2557
|
_addGeoJSONData: function _addGeoJSONData(coords) {
|
|
2558
|
-
var
|
|
2558
|
+
var _this8 = this;
|
|
2559
2559
|
|
|
2560
2560
|
each(coords, function (point) {
|
|
2561
|
-
|
|
2561
|
+
_this8._addPoint(point[1], point[0], point[2]);
|
|
2562
2562
|
|
|
2563
|
-
|
|
2563
|
+
_this8._fireEvt("elepoint_added", {
|
|
2564
2564
|
point: point,
|
|
2565
|
-
index:
|
|
2565
|
+
index: _this8._data.length - 1
|
|
2566
2566
|
});
|
|
2567
2567
|
});
|
|
2568
2568
|
|
|
@@ -2576,14 +2576,14 @@
|
|
|
2576
2576
|
* Parsing function for GPX data and their elevation in z-coordinate
|
|
2577
2577
|
*/
|
|
2578
2578
|
_addGPXData: function _addGPXData(coords) {
|
|
2579
|
-
var
|
|
2579
|
+
var _this9 = this;
|
|
2580
2580
|
|
|
2581
2581
|
each(coords, function (point) {
|
|
2582
|
-
|
|
2582
|
+
_this9._addPoint(point.lat, point.lng, typeof point.alt !== "undefined" ? point.alt : point.meta.ele);
|
|
2583
2583
|
|
|
2584
|
-
|
|
2584
|
+
_this9._fireEvt("elepoint_added", {
|
|
2585
2585
|
point: point,
|
|
2586
|
-
index:
|
|
2586
|
+
index: _this9._data.length - 1
|
|
2587
2587
|
});
|
|
2588
2588
|
});
|
|
2589
2589
|
|
|
@@ -2734,17 +2734,17 @@
|
|
|
2734
2734
|
this._fireEvt("elechart_init");
|
|
2735
2735
|
},
|
|
2736
2736
|
_initLayer: function _initLayer() {
|
|
2737
|
-
var
|
|
2737
|
+
var _this10 = this;
|
|
2738
2738
|
|
|
2739
2739
|
this._layers.on('layeradd layerremove', function (e) {
|
|
2740
2740
|
var layer = e.layer;
|
|
2741
2741
|
var node = layer.getElement && layer.getElement();
|
|
2742
2742
|
|
|
2743
|
-
toggleClass(node,
|
|
2743
|
+
toggleClass(node, _this10.options.polyline.className + ' ' + _this10.options.theme, e.type == 'layeradd');
|
|
2744
2744
|
|
|
2745
|
-
toggleEvent(layer, "mousemove",
|
|
2745
|
+
toggleEvent(layer, "mousemove", _this10._mousemoveLayerHandler.bind(_this10), e.type == 'layeradd');
|
|
2746
2746
|
|
|
2747
|
-
toggleEvent(layer, "mouseout",
|
|
2747
|
+
toggleEvent(layer, "mouseout", _this10._mouseoutHandler.bind(_this10), e.type == 'layeradd');
|
|
2748
2748
|
});
|
|
2749
2749
|
},
|
|
2750
2750
|
_initMarker: function _initMarker(map) {
|
|
@@ -2918,10 +2918,10 @@
|
|
|
2918
2918
|
* Add a waypoint marker to the diagram
|
|
2919
2919
|
*/
|
|
2920
2920
|
_registerCheckPoint: function _registerCheckPoint(props) {
|
|
2921
|
-
var
|
|
2921
|
+
var _this11 = this;
|
|
2922
2922
|
|
|
2923
2923
|
this.on("elechart_updated", function () {
|
|
2924
|
-
return
|
|
2924
|
+
return _this11._chart._registerCheckPoint(props);
|
|
2925
2925
|
});
|
|
2926
2926
|
},
|
|
2927
2927
|
|
|
@@ -2929,10 +2929,10 @@
|
|
|
2929
2929
|
* Add chart profile to diagram
|
|
2930
2930
|
*/
|
|
2931
2931
|
_registerAreaPath: function _registerAreaPath(props) {
|
|
2932
|
-
var
|
|
2932
|
+
var _this12 = this;
|
|
2933
2933
|
|
|
2934
2934
|
this.on("elechart_init", function () {
|
|
2935
|
-
return
|
|
2935
|
+
return _this12._chart._registerAreaPath(props);
|
|
2936
2936
|
});
|
|
2937
2937
|
},
|
|
2938
2938
|
|
|
@@ -2940,10 +2940,10 @@
|
|
|
2940
2940
|
* Add chart grid to diagram
|
|
2941
2941
|
*/
|
|
2942
2942
|
_registerAxisGrid: function _registerAxisGrid(props) {
|
|
2943
|
-
var
|
|
2943
|
+
var _this13 = this;
|
|
2944
2944
|
|
|
2945
2945
|
this.on("elechart_axis", function () {
|
|
2946
|
-
return
|
|
2946
|
+
return _this13._chart._registerAxisGrid(props);
|
|
2947
2947
|
});
|
|
2948
2948
|
},
|
|
2949
2949
|
|
|
@@ -2951,10 +2951,10 @@
|
|
|
2951
2951
|
* Add chart axis to diagram
|
|
2952
2952
|
*/
|
|
2953
2953
|
_registerAxisScale: function _registerAxisScale(props) {
|
|
2954
|
-
var
|
|
2954
|
+
var _this14 = this;
|
|
2955
2955
|
|
|
2956
2956
|
this.on("elechart_axis", function () {
|
|
2957
|
-
return
|
|
2957
|
+
return _this14._chart._registerAxisScale(props);
|
|
2958
2958
|
});
|
|
2959
2959
|
},
|
|
2960
2960
|
|
|
@@ -2962,14 +2962,14 @@
|
|
|
2962
2962
|
* Add chart or marker tooltip info
|
|
2963
2963
|
*/
|
|
2964
2964
|
_registerFocusLabel: function _registerFocusLabel(props) {
|
|
2965
|
-
var
|
|
2965
|
+
var _this15 = this;
|
|
2966
2966
|
|
|
2967
2967
|
if (props.chart) {
|
|
2968
2968
|
var label = L.extend({}, props, {
|
|
2969
2969
|
value: props.chart
|
|
2970
2970
|
});
|
|
2971
2971
|
this.on("elechart_init", function () {
|
|
2972
|
-
return
|
|
2972
|
+
return _this15._chart._registerFocusLabel(label);
|
|
2973
2973
|
});
|
|
2974
2974
|
}
|
|
2975
2975
|
|
|
@@ -2979,7 +2979,7 @@
|
|
|
2979
2979
|
});
|
|
2980
2980
|
|
|
2981
2981
|
this.on("elechart_marker", function () {
|
|
2982
|
-
return
|
|
2982
|
+
return _this15._marker._registerFocusLabel(_label);
|
|
2983
2983
|
});
|
|
2984
2984
|
}
|
|
2985
2985
|
},
|
|
@@ -2988,10 +2988,10 @@
|
|
|
2988
2988
|
* Add summary info to diagram
|
|
2989
2989
|
*/
|
|
2990
2990
|
_registerSummary: function _registerSummary(props) {
|
|
2991
|
-
var
|
|
2991
|
+
var _this16 = this;
|
|
2992
2992
|
|
|
2993
2993
|
this.on('elechart_summary', function () {
|
|
2994
|
-
return
|
|
2994
|
+
return _this16._summary._registerSummary(props);
|
|
2995
2995
|
});
|
|
2996
2996
|
},
|
|
2997
2997
|
|
|
@@ -3023,7 +3023,8 @@
|
|
|
3023
3023
|
* Hacky way for handling chart resize. Deletes it and redraw chart.
|
|
3024
3024
|
*/
|
|
3025
3025
|
_resizeChart: function _resizeChart() {
|
|
3026
|
-
// prevent displaying chart on resize if hidden
|
|
3026
|
+
if (!this._container) return; // prevent displaying chart on resize if hidden
|
|
3027
|
+
|
|
3027
3028
|
if (style(this._container, "display") == "none") return;
|
|
3028
3029
|
var opts = this.options;
|
|
3029
3030
|
|
|
@@ -3098,7 +3099,7 @@
|
|
|
3098
3099
|
* Toggle chart data on legend click
|
|
3099
3100
|
*/
|
|
3100
3101
|
_toggleChartHandler: function _toggleChartHandler(e) {
|
|
3101
|
-
var
|
|
3102
|
+
var _this17 = this;
|
|
3102
3103
|
|
|
3103
3104
|
var path = e.path,
|
|
3104
3105
|
name = e.name,
|
|
@@ -3108,7 +3109,7 @@
|
|
|
3108
3109
|
this._layers.eachLayer(function (layer) {
|
|
3109
3110
|
var node = layer.getElement && layer.getElement();
|
|
3110
3111
|
|
|
3111
|
-
toggleClass(node,
|
|
3112
|
+
toggleClass(node, _this17.options.polyline.className + ' ' + _this17.options.theme, _this17._chartEnabled);
|
|
3112
3113
|
}); // toggle option value (eg. altitude = { 'disabled' || 'disabled' })
|
|
3113
3114
|
|
|
3114
3115
|
|
|
@@ -3127,7 +3128,7 @@
|
|
|
3127
3128
|
_updateChart: function _updateChart() {
|
|
3128
3129
|
if (
|
|
3129
3130
|
/*!this._data.length ||*/
|
|
3130
|
-
!this._container) return;
|
|
3131
|
+
!this._chart || !this._container) return;
|
|
3131
3132
|
|
|
3132
3133
|
this._fireEvt("elechart_axis");
|
|
3133
3134
|
|
|
@@ -3182,7 +3183,7 @@
|
|
|
3182
3183
|
* Update chart summary.
|
|
3183
3184
|
*/
|
|
3184
3185
|
_updateSummary: function _updateSummary() {
|
|
3185
|
-
var
|
|
3186
|
+
var _this18 = this;
|
|
3186
3187
|
|
|
3187
3188
|
this._summary.reset();
|
|
3188
3189
|
|
|
@@ -3197,9 +3198,9 @@
|
|
|
3197
3198
|
select('.download a', this.summaryDiv).onclick = function (e) {
|
|
3198
3199
|
e.preventDefault();
|
|
3199
3200
|
|
|
3200
|
-
|
|
3201
|
-
downloadLink:
|
|
3202
|
-
confirm: saveFile.bind(
|
|
3201
|
+
_this18._fireEvt('eletrack_download', {
|
|
3202
|
+
downloadLink: _this18.options.downloadLink,
|
|
3203
|
+
confirm: saveFile.bind(_this18, _this18._downloadURL)
|
|
3203
3204
|
});
|
|
3204
3205
|
};
|
|
3205
3206
|
}
|
|
@@ -3263,7 +3264,7 @@
|
|
|
3263
3264
|
}
|
|
3264
3265
|
});
|
|
3265
3266
|
this.on('eledata_loaded', function (e) {
|
|
3266
|
-
var
|
|
3267
|
+
var _this19 = this;
|
|
3267
3268
|
|
|
3268
3269
|
var map = this._map;
|
|
3269
3270
|
var layer = e.layer;
|
|
@@ -3274,7 +3275,7 @@
|
|
|
3274
3275
|
}
|
|
3275
3276
|
|
|
3276
3277
|
map.once('layeradd', function (e) {
|
|
3277
|
-
return
|
|
3278
|
+
return _this19.options.autofitBounds && _this19.fitBounds(layer.getBounds());
|
|
3278
3279
|
});
|
|
3279
3280
|
|
|
3280
3281
|
if (L.Browser.mobile) {
|
|
@@ -3283,28 +3284,28 @@
|
|
|
3283
3284
|
// leaflet-geometryutil
|
|
3284
3285
|
Elevation._geomutilLazyLoader = lazyLoader(this.__LGEOMUTIL, typeof L.GeometryUtil !== 'function' || !this.options.lazyLoadJS, Elevation._geomutilLazyLoader).then(function () {
|
|
3285
3286
|
// leaflet-almostover
|
|
3286
|
-
if (
|
|
3287
|
-
Elevation._almostoverLazyLoader = lazyLoader(
|
|
3287
|
+
if (_this19.options.almostOver) {
|
|
3288
|
+
Elevation._almostoverLazyLoader = lazyLoader(_this19.__LALMOSTOVER, typeof L.Handler.AlmostOver !== 'function' || !_this19.options.lazyLoadJS, Elevation._almostoverLazyLoader).then(function () {
|
|
3288
3289
|
map.addHandler('almostOver', L.Handler.AlmostOver);
|
|
3289
3290
|
|
|
3290
3291
|
if (L.GeometryUtil && map.almostOver && map.almostOver.enabled()) {
|
|
3291
3292
|
map.almostOver.addLayer(layer);
|
|
3292
3293
|
map.on('almost:move', function (e) {
|
|
3293
|
-
return
|
|
3294
|
+
return _this19._mousemoveLayerHandler(e);
|
|
3294
3295
|
}).on('almost:out', function (e) {
|
|
3295
|
-
return
|
|
3296
|
+
return _this19._mouseoutHandler(e);
|
|
3296
3297
|
});
|
|
3297
3298
|
}
|
|
3298
3299
|
});
|
|
3299
3300
|
} // leaflet-distance-markers
|
|
3300
3301
|
|
|
3301
3302
|
|
|
3302
|
-
if (
|
|
3303
|
-
Elevation._distanceMarkersLazyLoader = lazyLoader(
|
|
3304
|
-
return
|
|
3303
|
+
if (_this19.options.distanceMarkers) {
|
|
3304
|
+
Elevation._distanceMarkersLazyLoader = lazyLoader(_this19.__LDISTANCEM, typeof L.DistanceMarkers !== 'function' || !_this19.options.lazyLoadJS, Elevation._distanceMarkersLazyLoader).then(function () {
|
|
3305
|
+
return _this19.options.polyline && layer.addTo(map);
|
|
3305
3306
|
});
|
|
3306
3307
|
} else {
|
|
3307
|
-
if (
|
|
3308
|
+
if (_this19.options.polyline) layer.addTo(map);
|
|
3308
3309
|
}
|
|
3309
3310
|
});
|
|
3310
3311
|
}
|
|
@@ -3325,7 +3326,7 @@
|
|
|
3325
3326
|
if (options.stroke && options.weight !== 0) {
|
|
3326
3327
|
var oldVal = ctx.globalCompositeOperation || 'source-over';
|
|
3327
3328
|
ctx.globalCompositeOperation = 'destination-over';
|
|
3328
|
-
ctx.strokeStyle = '#FFF';
|
|
3329
|
+
ctx.strokeStyle = color.outline || '#FFF';
|
|
3329
3330
|
ctx.lineWidth = options.weight * 1.75;
|
|
3330
3331
|
ctx.stroke();
|
|
3331
3332
|
ctx.globalCompositeOperation = oldVal;
|
|
@@ -3349,74 +3350,6 @@
|
|
|
3349
3350
|
});
|
|
3350
3351
|
});
|
|
3351
3352
|
|
|
3352
|
-
Elevation.addInitHook(function () {
|
|
3353
|
-
var _this2 = this;
|
|
3354
|
-
|
|
3355
|
-
var opts = this.options;
|
|
3356
|
-
var distance = {};
|
|
3357
|
-
|
|
3358
|
-
if (this.options.imperial) {
|
|
3359
|
-
this._distanceFactor = this.__mileFactor;
|
|
3360
|
-
this._xLabel = "mi";
|
|
3361
|
-
} else {
|
|
3362
|
-
this._distanceFactor = opts.distanceFactor;
|
|
3363
|
-
this._xLabel = opts.xLabel;
|
|
3364
|
-
}
|
|
3365
|
-
|
|
3366
|
-
this.on("eledata_updated", function (e) {
|
|
3367
|
-
var data = this._data;
|
|
3368
|
-
var i = e.index;
|
|
3369
|
-
var track = this.track_info;
|
|
3370
|
-
var dist = track.distance || 0;
|
|
3371
|
-
var curr = data[i].latlng;
|
|
3372
|
-
var prev = i > 0 ? data[i - 1].latlng : curr;
|
|
3373
|
-
|
|
3374
|
-
var delta = curr.distanceTo(prev) * this._distanceFactor;
|
|
3375
|
-
|
|
3376
|
-
dist += Math.round(delta / 1000 * 100000) / 100000; // handles floating points calc
|
|
3377
|
-
|
|
3378
|
-
data[i].dist = dist;
|
|
3379
|
-
track.distance = dist;
|
|
3380
|
-
});
|
|
3381
|
-
this.on("elechart_axis", function () {
|
|
3382
|
-
this._chart._registerAxisGrid({
|
|
3383
|
-
axis: "x",
|
|
3384
|
-
position: "bottom",
|
|
3385
|
-
scale: this._chart._x
|
|
3386
|
-
});
|
|
3387
|
-
});
|
|
3388
|
-
|
|
3389
|
-
if (this.options.distance != "summary") {
|
|
3390
|
-
this.on("elechart_axis", function () {
|
|
3391
|
-
var _this = this;
|
|
3392
|
-
|
|
3393
|
-
distance.x = this._chart._x;
|
|
3394
|
-
distance.label = this._chart._xLabel;
|
|
3395
|
-
|
|
3396
|
-
this._chart._registerAxisScale({
|
|
3397
|
-
axis: "x",
|
|
3398
|
-
position: "bottom",
|
|
3399
|
-
scale: distance.x,
|
|
3400
|
-
label: distance.label,
|
|
3401
|
-
labelY: 25,
|
|
3402
|
-
labelX: function labelX() {
|
|
3403
|
-
return _this._width() + 6;
|
|
3404
|
-
},
|
|
3405
|
-
name: "distance"
|
|
3406
|
-
});
|
|
3407
|
-
});
|
|
3408
|
-
}
|
|
3409
|
-
|
|
3410
|
-
this._registerSummary({
|
|
3411
|
-
"totlen": {
|
|
3412
|
-
label: "Total Length: ",
|
|
3413
|
-
value: function value(track) {
|
|
3414
|
-
return (track.distance || 0).toFixed(2) + ' ' + _this2._xLabel;
|
|
3415
|
-
}
|
|
3416
|
-
}
|
|
3417
|
-
});
|
|
3418
|
-
});
|
|
3419
|
-
|
|
3420
3353
|
Elevation.addInitHook(function () {
|
|
3421
3354
|
var _this = this;
|
|
3422
3355
|
|
|
@@ -3513,6 +3446,16 @@
|
|
|
3513
3446
|
});
|
|
3514
3447
|
}
|
|
3515
3448
|
|
|
3449
|
+
this._registerFocusLabel({
|
|
3450
|
+
name: 'y',
|
|
3451
|
+
chart: function chart(item) {
|
|
3452
|
+
return L._("y: ") + d3.format("." + opts.decimalsY + "f")(item[opts.yAttr]) + " " + _this._yLabel;
|
|
3453
|
+
},
|
|
3454
|
+
marker: function marker(item) {
|
|
3455
|
+
return d3.format("." + opts.decimalsY + "f")(item[opts.yAttr]) + " " + _this._yLabel;
|
|
3456
|
+
}
|
|
3457
|
+
});
|
|
3458
|
+
|
|
3516
3459
|
this._registerSummary({
|
|
3517
3460
|
"maxele": {
|
|
3518
3461
|
label: "Max Elevation: ",
|
|
@@ -3529,6 +3472,81 @@
|
|
|
3529
3472
|
});
|
|
3530
3473
|
});
|
|
3531
3474
|
|
|
3475
|
+
Elevation.addInitHook(function () {
|
|
3476
|
+
var _this2 = this;
|
|
3477
|
+
|
|
3478
|
+
var opts = this.options;
|
|
3479
|
+
var distance = {};
|
|
3480
|
+
|
|
3481
|
+
if (this.options.imperial) {
|
|
3482
|
+
this._distanceFactor = this.__mileFactor;
|
|
3483
|
+
this._xLabel = "mi";
|
|
3484
|
+
} else {
|
|
3485
|
+
this._distanceFactor = opts.distanceFactor;
|
|
3486
|
+
this._xLabel = opts.xLabel;
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3489
|
+
this.on("eledata_updated", function (e) {
|
|
3490
|
+
var data = this._data;
|
|
3491
|
+
var i = e.index;
|
|
3492
|
+
var track = this.track_info;
|
|
3493
|
+
var dist = track.distance || 0;
|
|
3494
|
+
var curr = data[i].latlng;
|
|
3495
|
+
var prev = i > 0 ? data[i - 1].latlng : curr;
|
|
3496
|
+
|
|
3497
|
+
var delta = curr.distanceTo(prev) * this._distanceFactor;
|
|
3498
|
+
|
|
3499
|
+
dist += Math.round(delta / 1000 * 100000) / 100000; // handles floating points calc
|
|
3500
|
+
|
|
3501
|
+
data[i].dist = dist;
|
|
3502
|
+
track.distance = dist;
|
|
3503
|
+
});
|
|
3504
|
+
this.on("elechart_axis", function () {
|
|
3505
|
+
this._chart._registerAxisGrid({
|
|
3506
|
+
axis: "x",
|
|
3507
|
+
position: "bottom",
|
|
3508
|
+
scale: this._chart._x
|
|
3509
|
+
});
|
|
3510
|
+
});
|
|
3511
|
+
|
|
3512
|
+
if (this.options.distance != "summary") {
|
|
3513
|
+
this.on("elechart_axis", function () {
|
|
3514
|
+
var _this = this;
|
|
3515
|
+
|
|
3516
|
+
distance.x = this._chart._x;
|
|
3517
|
+
distance.label = this._chart._xLabel;
|
|
3518
|
+
|
|
3519
|
+
this._chart._registerAxisScale({
|
|
3520
|
+
axis: "x",
|
|
3521
|
+
position: "bottom",
|
|
3522
|
+
scale: distance.x,
|
|
3523
|
+
label: distance.label,
|
|
3524
|
+
labelY: 25,
|
|
3525
|
+
labelX: function labelX() {
|
|
3526
|
+
return _this._width() + 6;
|
|
3527
|
+
},
|
|
3528
|
+
name: "distance"
|
|
3529
|
+
});
|
|
3530
|
+
});
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
this._registerFocusLabel({
|
|
3534
|
+
name: 'x',
|
|
3535
|
+
chart: function chart(item) {
|
|
3536
|
+
return L._("x: ") + d3.format("." + opts.decimalsX + "f")(item[opts.xAttr]) + " " + _this2._xLabel;
|
|
3537
|
+
}
|
|
3538
|
+
});
|
|
3539
|
+
|
|
3540
|
+
this._registerSummary({
|
|
3541
|
+
"totlen": {
|
|
3542
|
+
label: "Total Length: ",
|
|
3543
|
+
value: function value(track) {
|
|
3544
|
+
return (track.distance || 0).toFixed(2) + ' ' + _this2._xLabel;
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
});
|
|
3548
|
+
});
|
|
3549
|
+
|
|
3532
3550
|
Elevation.addInitHook(function () {
|
|
3533
3551
|
var _this = this;
|
|
3534
3552
|
|
|
@@ -3618,11 +3636,20 @@
|
|
|
3618
3636
|
this.track_info.time = duration;
|
|
3619
3637
|
});
|
|
3620
3638
|
|
|
3639
|
+
if (this.options.timestamps) {
|
|
3640
|
+
this._registerFocusLabel({
|
|
3641
|
+
name: 'date',
|
|
3642
|
+
chart: function chart(item) {
|
|
3643
|
+
return L._("t: ") + _this.options.timeFormat(item.time);
|
|
3644
|
+
}
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3621
3648
|
if (this.options.time) {
|
|
3622
3649
|
this._registerFocusLabel({
|
|
3623
3650
|
name: 'time',
|
|
3624
3651
|
chart: function chart(item) {
|
|
3625
|
-
return
|
|
3652
|
+
return L._("T: ") + formatTime(item.duration || 0);
|
|
3626
3653
|
}
|
|
3627
3654
|
});
|
|
3628
3655
|
|
|
@@ -3726,7 +3753,7 @@
|
|
|
3726
3753
|
this._registerFocusLabel({
|
|
3727
3754
|
name: 'slope',
|
|
3728
3755
|
chart: function chart(item) {
|
|
3729
|
-
return item.slope + slope.label;
|
|
3756
|
+
return L._("m: ") + item.slope + slope.label;
|
|
3730
3757
|
},
|
|
3731
3758
|
marker: function marker(item) {
|
|
3732
3759
|
return Math.round(item.slope) + slope.label;
|
|
@@ -3846,7 +3873,7 @@
|
|
|
3846
3873
|
this._registerFocusLabel({
|
|
3847
3874
|
name: 'speed',
|
|
3848
3875
|
chart: function chart(item) {
|
|
3849
|
-
return item.speed + " " + speed.label;
|
|
3876
|
+
return L._('v: ') + item.speed + " " + speed.label;
|
|
3850
3877
|
},
|
|
3851
3878
|
marker: function marker(item) {
|
|
3852
3879
|
return Math.round(item.speed) + " " + speed.label;
|
|
@@ -3962,7 +3989,7 @@
|
|
|
3962
3989
|
this._registerFocusLabel({
|
|
3963
3990
|
name: 'acceleration',
|
|
3964
3991
|
chart: function chart(item) {
|
|
3965
|
-
return item.acceleration + " " + acceleration.label;
|
|
3992
|
+
return L._("a: ") + item.acceleration + " " + acceleration.label;
|
|
3966
3993
|
},
|
|
3967
3994
|
marker: function marker(item) {
|
|
3968
3995
|
return Math.round(item.acceleration) + " " + acceleration.label;
|
|
@@ -4029,6 +4056,19 @@
|
|
|
4029
4056
|
Elevation.Utils = _;
|
|
4030
4057
|
Elevation.Components = D3;
|
|
4031
4058
|
Elevation.Chart = Chart$1;
|
|
4059
|
+
/* Temporary fix for empty values evaluated as false (leaflet-i18n v0.3.1) */
|
|
4060
|
+
|
|
4061
|
+
(function () {
|
|
4062
|
+
var proto = L.i18n.bind({});
|
|
4063
|
+
|
|
4064
|
+
L.i18n = L._ = function (string, data) {
|
|
4065
|
+
if (L.locale && L.locales[L.locale] && L.locales[L.locale][string] == "") {
|
|
4066
|
+
L.locales[L.locale][string] = "\u200B";
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4069
|
+
return proto.call(null, string, data);
|
|
4070
|
+
};
|
|
4071
|
+
})();
|
|
4032
4072
|
|
|
4033
4073
|
L.control.elevation = function (options) {
|
|
4034
4074
|
return new Elevation(options);
|