@raruto/leaflet-elevation 1.9.4 → 2.0.0
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 +8 -7
- package/dist/leaflet-elevation.css +51 -161
- package/dist/leaflet-elevation.js +1622 -3767
- package/dist/leaflet-elevation.js.map +1 -1
- package/dist/leaflet-elevation.min.css +1 -1
- package/dist/leaflet-elevation.min.js +1 -3
- package/dist/leaflet-elevation.min.js.map +1 -1
- package/images/checkered.png +0 -0
- package/libs/leaflet-distance-marker.js +17 -18
- package/libs/leaflet-distance-marker.min.js +1 -1
- package/libs/leaflet-gpxgroup.js +2 -2
- package/libs/leaflet-ruler.css +42 -0
- package/libs/leaflet-ruler.js +183 -0
- package/libs/leaflet-ruler.min.css +1 -0
- package/libs/leaflet-ruler.min.js +1 -0
- package/package.json +9 -11
- package/src/chart.js +156 -143
- package/src/components.js +55 -76
- package/src/control.js +503 -345
- package/src/handlers/acceleration.js +64 -0
- package/src/handlers/acceleration.min.js +1 -0
- package/src/handlers/altitude.js +76 -0
- package/src/handlers/altitude.min.js +1 -0
- package/src/handlers/cadence.js +54 -0
- package/src/handlers/distance.js +45 -0
- package/src/handlers/distance.min.js +1 -0
- package/src/handlers/heart.js +53 -0
- package/src/handlers/slope.js +79 -0
- package/src/handlers/slope.min.js +1 -0
- package/src/handlers/speed.js +66 -0
- package/src/handlers/speed.min.js +1 -0
- package/src/handlers/time.js +103 -0
- package/src/handlers/time.min.js +1 -0
- package/src/index.css +51 -161
- package/src/index.js +0 -24
- package/src/marker.js +11 -14
- package/src/options.js +20 -28
- package/src/summary.js +14 -4
- package/src/utils.js +74 -102
- package/src/acceleration.js +0 -108
- package/src/altitude.js +0 -120
- package/src/distance.js +0 -78
- package/src/slope.js +0 -113
- package/src/speed.js +0 -110
- package/src/time.js +0 -124
package/src/index.css
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.elevation-control.elevation .background {
|
|
31
|
-
background-color: rgba(70, 130, 180, 0.2);
|
|
31
|
+
background-color: var(--ele-bg, rgba(70, 130, 180, 0.2));
|
|
32
32
|
border-radius: 5px;
|
|
33
33
|
overflow: visible;
|
|
34
34
|
display: block;
|
|
@@ -36,15 +36,20 @@
|
|
|
36
36
|
user-select: none;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
.elevation-control.elevation .axis .tick,
|
|
40
|
+
.elevation-control.elevation .axis .domain {
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
.elevation-control.elevation .axis line,
|
|
40
45
|
.elevation-control.elevation .axis path {
|
|
41
|
-
stroke: #2D1130;
|
|
46
|
+
stroke: var(--ele-axis, #2D1130);
|
|
42
47
|
stroke-width: 1;
|
|
43
48
|
fill: none;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
.elevation-control.elevation .grid .tick line {
|
|
47
|
-
stroke: #EEE;
|
|
52
|
+
stroke: var(--ele-grid, #EEE);
|
|
48
53
|
stroke-width: 1px;
|
|
49
54
|
shape-rendering: crispEdges;
|
|
50
55
|
}
|
|
@@ -68,14 +73,14 @@
|
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
.elevation-control.elevation .area {
|
|
71
|
-
fill: #4682B4;
|
|
72
|
-
stroke: #000;
|
|
76
|
+
fill: var(--ele-area, #4682B4);
|
|
77
|
+
stroke: var(--ele-stroke, #000);
|
|
73
78
|
stroke-width: 1.2;
|
|
74
79
|
paint-order: stroke fill;
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
.elevation-detached .elevation-control.elevation .area {
|
|
78
|
-
fill-opacity: 0.8;
|
|
83
|
+
fill-opacity: var(--ele-alpha, 0.8);
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
.elevation-control.elevation .horizontal-drag-line {
|
|
@@ -104,7 +109,7 @@
|
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
.elevation-control.elevation .mouse-focus-line {
|
|
107
|
-
stroke: #
|
|
112
|
+
stroke: #000;
|
|
108
113
|
stroke-width: 1;
|
|
109
114
|
pointer-events: none;
|
|
110
115
|
}
|
|
@@ -128,7 +133,7 @@
|
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
.elevation-control.elevation .brush .selection {
|
|
131
|
-
fill: rgba(23, 74, 117, 0.4);
|
|
136
|
+
fill: var(--ele-brush, rgba(23, 74, 117, 0.4));
|
|
132
137
|
stroke: none;
|
|
133
138
|
fill-opacity: unset;
|
|
134
139
|
}
|
|
@@ -207,7 +212,7 @@
|
|
|
207
212
|
}
|
|
208
213
|
|
|
209
214
|
.elevation-control.elevation .elevation-toggle-icon {
|
|
210
|
-
background: url(../images/elevation.svg) no-repeat center center;
|
|
215
|
+
background: var(--ele-icon, url(../images/elevation-lime.svg)) no-repeat center center;
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
.elevation-control.elevation.elevation-expanded .elevation-toggle-icon.close-button {
|
|
@@ -241,7 +246,7 @@
|
|
|
241
246
|
.leaflet-elevation-pane .height-focus,
|
|
242
247
|
.leaflet-overlay-pane .height-focus {
|
|
243
248
|
stroke: #000;
|
|
244
|
-
fill: #FFF;
|
|
249
|
+
fill: var(--ele-area, #FFF);
|
|
245
250
|
}
|
|
246
251
|
|
|
247
252
|
.leaflet-elevation-pane .height-focus.line,
|
|
@@ -260,193 +265,78 @@
|
|
|
260
265
|
stroke-width: 2px;
|
|
261
266
|
}
|
|
262
267
|
|
|
263
|
-
.elevation-waypoint-icon:before
|
|
264
|
-
|
|
268
|
+
.elevation-waypoint-icon:before,
|
|
269
|
+
.elevation-position-icon:before {
|
|
265
270
|
content: "";
|
|
266
271
|
width: 100%;
|
|
267
272
|
height: 100%;
|
|
268
273
|
display: inline-block;
|
|
269
274
|
}
|
|
270
275
|
|
|
276
|
+
.elevation-waypoint-icon:before {
|
|
277
|
+
background: url(../images/elevation-pushpin.svg) no-repeat center center / contain;
|
|
278
|
+
}
|
|
279
|
+
|
|
271
280
|
.elevation-position-icon:before {
|
|
272
281
|
background: url(../images/elevation-position.svg) no-repeat center center / contain;
|
|
273
|
-
content: "";
|
|
274
|
-
width: 100%;
|
|
275
|
-
height: 100%;
|
|
276
|
-
display: inline-block;
|
|
277
282
|
}
|
|
278
283
|
|
|
279
284
|
.elevation-polyline {
|
|
285
|
+
stroke: var(--ele-poly, var(--ele-area, #000));
|
|
280
286
|
filter: drop-shadow(1px 1px 0 #FFF) drop-shadow(-1px -1px 0 #FFF) drop-shadow(1px -1px 0 #FFF) drop-shadow(-1px 1px 0 #FFF);
|
|
281
287
|
}
|
|
282
288
|
|
|
283
|
-
.elevation-placeholder {
|
|
284
|
-
margin: auto;
|
|
285
|
-
height: auto;
|
|
286
|
-
width: 100%;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.elevation-placeholder~* {
|
|
290
|
-
display: none !important;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
289
|
/* LIME THEME //////////////////////////////////////////////// */
|
|
294
|
-
.lime-theme
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
.lime-theme.elevation-control.elevation .grid .tick line {
|
|
304
|
-
stroke: #CCC;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.lime-theme.elevation-control.elevation .brush .selection {
|
|
308
|
-
fill: rgba(99, 126, 11, 0.4);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.lime-theme.elevation-control.elevation .elevation-toggle-icon {
|
|
312
|
-
background: url(../images/elevation-lime.svg) no-repeat center center;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.lime-theme.elevation-control.elevation .area {
|
|
316
|
-
fill: #9CC222;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.lime-theme.elevation-control.elevation .mouse-focus-line {
|
|
320
|
-
stroke: #101404;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.lime-theme.height-focus {
|
|
324
|
-
stroke: #000;
|
|
325
|
-
fill: #9CC222;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.lime-theme.elevation-polyline {
|
|
329
|
-
stroke: #566B13;
|
|
290
|
+
.lime-theme {
|
|
291
|
+
--ele-bg: rgba(156, 194, 34, 0.2);
|
|
292
|
+
--ele-axis: #566B13;
|
|
293
|
+
--ele-area: #9CC222;
|
|
294
|
+
--ele-grid: #CCC;
|
|
295
|
+
--ele-brush: rgba(99, 126, 11, 0.4);
|
|
296
|
+
--ele-icon: url(../images/elevation-lime.svg);
|
|
297
|
+
--ele-poly: #566B13;
|
|
330
298
|
}
|
|
331
299
|
|
|
332
300
|
/* STEELBLUE THEME //////////////////////////////////////////////// */
|
|
333
|
-
.steelblue-theme
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
.steelblue-theme.elevation-control.elevation .axis path {
|
|
339
|
-
stroke: #0D1821;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.steelblue-theme.elevation-control.elevation .brush .selection {
|
|
343
|
-
fill: rgba(23, 74, 117, 0.4);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.steelblue-theme.elevation-control.elevation .elevation-toggle-icon {
|
|
347
|
-
background: url(../images/elevation-steelblue.svg) no-repeat center center;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.steelblue-theme.elevation-control.elevation .area {
|
|
351
|
-
fill: #4682B4;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.steelblue-theme.elevation-control.elevation .mouse-focus-line {
|
|
355
|
-
stroke: #0D1821;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.steelblue-theme.height-focus {
|
|
359
|
-
stroke: #000;
|
|
360
|
-
fill: #4682B4;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.steelblue-theme.elevation-polyline {
|
|
364
|
-
stroke: #4682B4;
|
|
301
|
+
.steelblue-theme {
|
|
302
|
+
--ele-axis: #0D1821;
|
|
303
|
+
--ele-area: #4682B4;
|
|
304
|
+
--ele-brush: rgba(23, 74, 117, 0.4);
|
|
305
|
+
--ele-icon: url(../images/elevation-steelblue.svg);
|
|
365
306
|
}
|
|
366
307
|
|
|
367
308
|
/* PURPLE THEME //////////////////////////////////////////////// */
|
|
368
|
-
.purple-theme
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
.purple-theme.elevation-control.elevation .axis path {
|
|
374
|
-
stroke: #2D1130;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.purple-theme.elevation-control.elevation .brush .selection {
|
|
378
|
-
fill: rgba(74, 14, 80, 0.4);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.purple-theme.elevation-control.elevation .elevation-toggle-icon {
|
|
382
|
-
background: url(../images/elevation-purple.svg) no-repeat center center;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.purple-theme.elevation-control.elevation .area {
|
|
386
|
-
fill: #732C7B;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.purple-theme.elevation-control.elevation .mouse-focus-line {
|
|
390
|
-
stroke: #000;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
.purple-theme.height-focus {
|
|
394
|
-
stroke: #000;
|
|
395
|
-
fill: #732C7B;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.purple-theme.elevation-polyline {
|
|
399
|
-
stroke: #732C7B;
|
|
309
|
+
.purple-theme {
|
|
310
|
+
--ele-bg: rgba(115, 44, 123, 0.2);
|
|
311
|
+
--ele-area: #732C7B;
|
|
312
|
+
--ele-brush: rgba(74, 14, 80, 0.4);
|
|
313
|
+
--ele-icon: url(../images/elevation-purple.svg);
|
|
400
314
|
}
|
|
401
315
|
|
|
402
316
|
/* YELLOW THEME //////////////////////////////////////////////// */
|
|
403
|
-
.yellow-theme
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
.yellow-theme.elevation-polyline {
|
|
408
|
-
stroke: #FF0;
|
|
317
|
+
.yellow-theme {
|
|
318
|
+
--ele-area: #FF0;
|
|
409
319
|
}
|
|
410
320
|
|
|
411
321
|
/* RED THEME //////////////////////////////////////////////// */
|
|
412
|
-
.red-theme
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.red-theme.elevation-polyline {
|
|
417
|
-
stroke: #F00;
|
|
322
|
+
.red-theme {
|
|
323
|
+
--ele-area: #F00;
|
|
418
324
|
}
|
|
419
325
|
|
|
420
326
|
/* MAGENTA THEME //////////////////////////////////////////////// */
|
|
421
|
-
.magenta-theme
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
.magenta-theme.elevation-control.elevation .area {
|
|
426
|
-
fill: #FF005E;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
.magenta-theme.elevation-polyline {
|
|
430
|
-
stroke: #FF005E;
|
|
327
|
+
.magenta-theme {
|
|
328
|
+
--ele-bg: rgba(255, 255, 255, 0.47);
|
|
329
|
+
--ele-area: #FF005E;
|
|
431
330
|
}
|
|
432
331
|
|
|
433
332
|
/* LIGHTBLUE THEME //////////////////////////////////////////////// */
|
|
434
|
-
.lightblue-theme
|
|
435
|
-
|
|
436
|
-
|
|
333
|
+
.lightblue-theme {
|
|
334
|
+
--ele-area: #3366CC;
|
|
335
|
+
--ele-alpha: 0.45;
|
|
336
|
+
--ele-stroke: #4682B4;
|
|
437
337
|
}
|
|
438
338
|
|
|
439
339
|
.elevation-detached .lightblue-theme.elevation-control.elevation .area {
|
|
440
|
-
fill-opacity: 0.45;
|
|
441
|
-
stroke: #3366CC;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.lightblue-theme.height-focus {
|
|
445
|
-
stroke: #000;
|
|
446
|
-
fill: #FFFFFF;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.lightblue-theme.elevation-polyline {
|
|
450
340
|
stroke: #3366CC;
|
|
451
341
|
}
|
|
452
342
|
|
package/src/index.js
CHANGED
|
@@ -36,19 +36,9 @@
|
|
|
36
36
|
|
|
37
37
|
import 'leaflet-i18n';
|
|
38
38
|
import * as _ from './utils';
|
|
39
|
-
import * as D3 from './components';
|
|
40
|
-
import { Chart } from './chart';
|
|
41
39
|
import { Elevation } from './control';
|
|
42
|
-
import './altitude';
|
|
43
|
-
import './distance';
|
|
44
|
-
import './time';
|
|
45
|
-
import './slope';
|
|
46
|
-
import './speed';
|
|
47
|
-
import './acceleration';
|
|
48
40
|
|
|
49
41
|
Elevation.Utils = _;
|
|
50
|
-
Elevation.Components = D3;
|
|
51
|
-
Elevation.Chart = Chart;
|
|
52
42
|
|
|
53
43
|
/* Temporary fix for empty values evaluated as false (leaflet-i18n v0.3.1) */
|
|
54
44
|
(function(){
|
|
@@ -61,18 +51,4 @@ Elevation.Chart = Chart;
|
|
|
61
51
|
};
|
|
62
52
|
})();
|
|
63
53
|
|
|
64
|
-
// Alias deprecated functions
|
|
65
|
-
Elevation.addInitHook(function() {
|
|
66
|
-
this.enableDragging = this.enableBrush;
|
|
67
|
-
this.disableDragging = this.disableBrush;
|
|
68
|
-
this.loadChart = this.addTo;
|
|
69
|
-
this.loadData = this.load;
|
|
70
|
-
this.loadGPX = this.load;
|
|
71
|
-
this.loadGeoJSON = this.load;
|
|
72
|
-
this.loadXML = this.load;
|
|
73
|
-
this.loadFile = this.load;
|
|
74
|
-
this._addGPXData = this._addGeoJSONData;
|
|
75
|
-
this._registerFocusLabel = this._registerTooltip;
|
|
76
|
-
});
|
|
77
|
-
|
|
78
54
|
L.control.elevation = (options) => new Elevation(options);
|
package/src/marker.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as D3 from './components.js';
|
|
2
|
+
|
|
3
|
+
const _ = L.Control.Elevation.Utils;
|
|
4
4
|
|
|
5
5
|
export var Marker = L.Class.extend({
|
|
6
6
|
|
|
7
|
-
initialize: function(options) {
|
|
7
|
+
initialize: function(options, control) {
|
|
8
8
|
this.options = options;
|
|
9
|
+
this.control = control
|
|
9
10
|
|
|
10
11
|
switch(this.options.marker) {
|
|
11
12
|
case 'elevation-line':
|
|
@@ -51,14 +52,18 @@ export var Marker = L.Class.extend({
|
|
|
51
52
|
let point = this._map.latLngToLayerPoint(this._latlng);
|
|
52
53
|
point = L.extend({}, props.item, this._map._rotate ? this._map.rotatedPointToMapPanePoint(point) : point);
|
|
53
54
|
|
|
55
|
+
let yMax = (this.control._height() / props.yCoordMax * point[this.options.yAttr]);
|
|
56
|
+
|
|
57
|
+
if(!isFinite(yMax) || isNaN(yMax)) yMax = 0;
|
|
58
|
+
|
|
54
59
|
this._container.classed("leaflet-hidden", false);
|
|
55
60
|
this._container.call(D3.PositionMarker({
|
|
56
61
|
theme : this.options.theme,
|
|
57
62
|
xCoord: point.x,
|
|
58
63
|
yCoord: point.y,
|
|
59
|
-
length: point.y -
|
|
64
|
+
length: point.y - yMax, // normalized Y
|
|
60
65
|
labels: this._labels,
|
|
61
|
-
item: point
|
|
66
|
+
item: point,
|
|
62
67
|
}));
|
|
63
68
|
}
|
|
64
69
|
break;
|
|
@@ -84,14 +89,6 @@ export var Marker = L.Class.extend({
|
|
|
84
89
|
return this._latlng;
|
|
85
90
|
},
|
|
86
91
|
|
|
87
|
-
/**
|
|
88
|
-
* Calculates chart height.
|
|
89
|
-
*/
|
|
90
|
-
_height: function() {
|
|
91
|
-
let opts = this.options;
|
|
92
|
-
return opts.height - opts.margins.top - opts.margins.bottom;
|
|
93
|
-
},
|
|
94
|
-
|
|
95
92
|
_registerTooltip: function(props) {
|
|
96
93
|
this._labels[props.name] = props;
|
|
97
94
|
}
|
package/src/options.js
CHANGED
|
@@ -9,29 +9,14 @@ export var Options = {
|
|
|
9
9
|
collapsed: false,
|
|
10
10
|
detached: true,
|
|
11
11
|
distance: true,
|
|
12
|
-
distanceMarkers: {
|
|
13
|
-
lazy: true,
|
|
14
|
-
distance: true,
|
|
15
|
-
arrow: false
|
|
16
|
-
},
|
|
17
|
-
decimalsX: 2,
|
|
18
|
-
decimalsY: 0,
|
|
12
|
+
distanceMarkers: { lazy: true, distance: true, direction: true },
|
|
19
13
|
dragging: !L.Browser.mobile,
|
|
20
14
|
downloadLink: 'link',
|
|
21
15
|
elevationDiv: "#elevation-div",
|
|
22
16
|
followMarker: true,
|
|
23
|
-
forceAxisBounds: false,
|
|
24
|
-
height: 200,
|
|
25
17
|
imperial: false,
|
|
26
|
-
interpolation: "curveLinear",
|
|
27
|
-
lazyLoadJS: true,
|
|
28
18
|
legend: true,
|
|
29
|
-
|
|
30
|
-
top: 30,
|
|
31
|
-
right: 30,
|
|
32
|
-
bottom: 30,
|
|
33
|
-
left: 40
|
|
34
|
-
},
|
|
19
|
+
handlers: [],
|
|
35
20
|
marker: 'elevation-line',
|
|
36
21
|
markerIcon: L.divIcon({
|
|
37
22
|
className: 'elevation-position-marker',
|
|
@@ -55,20 +40,15 @@ export var Options = {
|
|
|
55
40
|
preferCanvas: false,
|
|
56
41
|
reverseCoords: false,
|
|
57
42
|
ruler: true,
|
|
58
|
-
skipNullZCoords: false,
|
|
59
43
|
theme: "lightblue-theme",
|
|
60
44
|
summary: 'inline',
|
|
61
45
|
slope: false,
|
|
62
46
|
speed: false,
|
|
63
|
-
sLimit: undefined,
|
|
64
47
|
time: false,
|
|
65
48
|
timeFactor: 3600,
|
|
66
|
-
timeFormat: false,
|
|
67
49
|
timestamps: false,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
sRange: undefined,
|
|
71
|
-
width: 600,
|
|
50
|
+
trkStart: L.circleMarker([0,0], { className: 'start-marker', radius: 6, weight: 2, color: '#fff', fillColor: '#00d800', fillOpacity: 1, interactive: false }),
|
|
51
|
+
trkEnd: L.circleMarker([0,0], { className: 'end-marker', radius: 6, weight: 2, color: '#fff', fillColor: '#ff0606', fillOpacity: 1, interactive: false }),
|
|
72
52
|
waypoints: true,
|
|
73
53
|
wptIcons: {
|
|
74
54
|
'': L.divIcon({
|
|
@@ -81,12 +61,24 @@ export var Options = {
|
|
|
81
61
|
wptLabels: true,
|
|
82
62
|
xAttr: "dist",
|
|
83
63
|
xLabel: "km",
|
|
84
|
-
xTicks: undefined,
|
|
85
64
|
yAttr: "z",
|
|
86
|
-
yAxisMax: undefined,
|
|
87
|
-
yAxisMin: undefined,
|
|
88
65
|
yLabel: "m",
|
|
89
|
-
yTicks: undefined,
|
|
90
66
|
zFollow: false,
|
|
91
67
|
zooming: !L.Browser.Mobile,
|
|
68
|
+
|
|
69
|
+
// Quite uncommon and undocumented options (quite useless)
|
|
70
|
+
decimalsX: 2,
|
|
71
|
+
decimalsY: 0,
|
|
72
|
+
forceAxisBounds: false,
|
|
73
|
+
interpolation: "curveLinear",
|
|
74
|
+
skipNullZCoords: false,
|
|
75
|
+
yAxisMax: undefined,
|
|
76
|
+
yAxisMin: undefined,
|
|
77
|
+
|
|
78
|
+
// Probably no longer functional as expected (internally overwritten)
|
|
79
|
+
margins: { top: 30, right: 30, bottom: 30, left: 40 },
|
|
80
|
+
height: 200,
|
|
81
|
+
width: 600,
|
|
82
|
+
xTicks: undefined,
|
|
83
|
+
yTicks: undefined,
|
|
92
84
|
};
|
package/src/summary.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import * as _ from './utils';
|
|
3
|
-
import * as D3 from './components';
|
|
1
|
+
const _ = L.Control.Elevation.Utils;
|
|
4
2
|
|
|
5
3
|
export var Summary = L.Class.extend({
|
|
6
4
|
initialize: function(opts, control) {
|
|
7
5
|
this.options = opts;
|
|
8
6
|
this.control = control;
|
|
7
|
+
this.labels = {};
|
|
9
8
|
|
|
10
9
|
let summary = this._container = _.create("div", "elevation-summary " + (opts.summary ? opts.summary + "-summary" : ''));
|
|
11
10
|
_.style(summary, 'max-width', opts.width ? opts.width + 'px' : '');
|
|
@@ -24,9 +23,20 @@ export var Summary = L.Class.extend({
|
|
|
24
23
|
return this;
|
|
25
24
|
},
|
|
26
25
|
|
|
26
|
+
update: function() {
|
|
27
|
+
Object
|
|
28
|
+
.keys(this.labels)
|
|
29
|
+
.sort((a, b) => this.labels[a].order - this.labels[b].order) // TODO: any performance issues?
|
|
30
|
+
.forEach((i)=> {
|
|
31
|
+
let value = typeof this.labels[i].value !== "function" ? this.labels[i].value : this.labels[i].value(this.control.track_info, this.labels[i].unit || '');
|
|
32
|
+
this.append(i /*+ " order-" + this.labels[i].order*/, L._(this.labels[i].label), value, this.labels[i].order);
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
|
|
27
36
|
_registerSummary: function(data) {
|
|
28
37
|
for (let i in data) {
|
|
29
|
-
|
|
38
|
+
data[i].order = data[i].order ?? 1000;
|
|
39
|
+
this.labels[i] = data[i];
|
|
30
40
|
}
|
|
31
41
|
}
|
|
32
42
|
|