@raruto/leaflet-elevation 2.2.0 → 2.2.3

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.
@@ -1,341 +1,341 @@
1
- /*
2
- * https://github.com/adoroszlai/joebed/tree/gh-pages
3
- *
4
- * The MIT License (MIT)
5
- *
6
- * Copyright (c) 2014- Doroszlai Attila, 2019- Raruto
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
- * this software and associated documentation files (the "Software"), to deal in
10
- * the Software without restriction, including without limitation the rights to
11
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
- * the Software, and to permit persons to whom the Software is furnished to do so,
13
- * subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- */
25
-
26
- L.Mixin.Selectable = {
27
- includes: L.Mixin.Events,
28
-
29
- setSelected: function(s) {
30
- var selected = !!s;
31
- if (this._selected !== selected) {
32
- this._selected = selected;
33
- this.fire('selected');
34
- }
35
- },
36
-
37
- isSelected: function() {
38
- return !!this._selected;
39
- },
40
- };
41
-
42
- L.Mixin.Selection = {
43
- includes: L.Mixin.Events,
44
-
45
- getSelection: function() {
46
- return this._selected;
47
- },
48
-
49
- setSelection: function(item) {
50
- if (this._selected === item) {
51
- if (item !== null) {
52
- item.setSelected(!item.isSelected());
53
- if (!item.isSelected()) {
54
- this._selected = null;
55
- }
56
- }
57
- } else {
58
- if (this._selected) {
59
- this._selected.setSelected(false);
60
- }
61
- this._selected = item;
62
- if (this._selected) {
63
- this._selected.setSelected(true);
64
- }
65
- }
66
- this.fire('selection_changed');
67
- },
68
- };
69
-
70
- L.Control.LayersLegend = L.Control.Layers.extend({
71
- _onInputClick: function() {
72
- this._handlingClick = true;
73
-
74
- this._layerControlInputs.reduceRight((_,input) => {
75
- if (input.checked) {
76
- this._map.fireEvent("legend_selected", {
77
- layer: this._getLayer(input.layerId).layer,
78
- input: input,
79
- }, true);
80
- return input;
81
- }
82
- }, 0);
83
-
84
- this._handlingClick = false;
85
-
86
- this._refocusOnMap();
87
- }
88
- });
89
-
90
- L.control.layersLegend = (baseLayers, overlays, options) => new L.Control.LayersLegend(baseLayers, overlays, options);
91
-
92
- L.GeoJSON.include(L.Mixin.Selectable);
93
-
94
- L.GpxGroup = L.Class.extend({
95
- options: {
96
- highlight: {
97
- color: '#ff0',
98
- opacity: 1,
99
- },
100
- points: [],
101
- points_options: {
102
- icon: {
103
- iconUrl: '../images/elevation-poi.png',
104
- iconSize: [12, 12],
105
- }
106
- },
107
- flyToBounds: true,
108
- legend: false,
109
- legend_options: {
110
- position: "topright",
111
- collapsed: false,
112
- },
113
- elevation: true,
114
- elevation_options: {
115
- theme: 'yellow-theme',
116
- detached: true,
117
- elevationDiv: '#elevation-div',
118
- },
119
- distanceMarkers: true,
120
- distanceMarkers_options: {
121
- lazy: true
122
- },
123
- },
124
-
125
- initialize: function(tracks, options) {
126
-
127
- L.Util.setOptions(this, options);
128
-
129
- this._count = 0;
130
- this._loadedCount = 0;
131
- this._tracks = tracks;
132
- this._layers = L.featureGroup();
133
- this._markers = L.featureGroup();
134
- this._elevation = L.control.elevation(this.options.elevation_options);
135
- this._legend = L.control.layersLegend(null, null, this.options.legend_options);
136
-
137
- this.options.points.forEach((poi) =>
138
- L
139
- .marker(poi.latlng, { icon: L.icon(this.options.points_options.icon) })
140
- .bindTooltip(poi.name, { direction: 'auto' }).addTo(this._markers)
141
- );
142
-
143
- },
144
-
145
- getBounds: function() {
146
- return this._layers.getBounds();
147
- },
148
-
149
- addTo: function(map) {
150
- this._layers.addTo(map);
151
- this._markers.addTo(map);
152
-
153
- this._map = map;
154
-
155
- this.on('selection_changed', this._onSelectionChanged, this);
156
- this._map.on('legend_selected', this._onLegendSelected, this);
157
- this._tracks.forEach(this.addTrack, this);
158
-
159
- },
160
-
161
- addTrack: function(track) {
162
- fetch(track)
163
- .then(response => response.ok && response.text())
164
- .then(text => this._elevation._parseFromString(text))
165
- .then(geojson => {
166
- if(geojson) {
167
- geojson.name = geojson.name || (geojson[0] && geojson[0].properties.name) || track.split('/').pop().split('#')[0].split('?')[0];
168
- this._loadRoute(geojson);
169
- }
170
- });
171
- },
172
-
173
- _loadRoute: function(data) {
174
- if (!data) return;
175
-
176
- var line_style = {
177
- color: this._uniqueColors(this._tracks.length)[this._count++],
178
- opacity: 0.75,
179
- weight: 5,
180
- distanceMarkers: this.options.distanceMarkers_options,
181
- };
182
-
183
- var route = L.geoJson(data, {
184
- name: data.name || '',
185
- style: (feature) => line_style,
186
- distanceMarkers: line_style.distanceMarkers,
187
- originalStyle: line_style,
188
- filter: feature => feature.geometry.type != "Point",
189
- });
190
-
191
-
192
- this._elevation.import(this._elevation.__LGEOMUTIL).then(() => {
193
- route.addTo(this._layers);
194
-
195
- route.eachLayer((layer) => this._onEachRouteLayer(route, layer));
196
- this._onEachRouteLoaded(route);
197
- });
198
-
199
- },
200
-
201
- _onEachRouteLayer: function(route, layer) {
202
- var polyline = layer;
203
-
204
- route.on('selected', L.bind(this._onRouteSelected, this, route, polyline));
205
-
206
- polyline.on('mouseover', L.bind(this._onRouteMouseOver, this, route, polyline));
207
- polyline.on('mouseout', L.bind(this._onRouteMouseOut, this, route, polyline));
208
- polyline.on('click', L.bind(this._onRouteClick, this, route, polyline));
209
-
210
- polyline.bindTooltip(route.options.name, { direction: 'auto', sticky: true, });
211
- },
212
-
213
- _onEachRouteLoaded: function(route) {
214
- if (this.options.legend) {
215
- this._legend.addBaseLayer(route, '<svg id="legend_' + route._leaflet_id + '" width="25" height="10" version="1.1" xmlns="http://www.w3.org/2000/svg">' + '<line x1="0" x2="50" y1="5" y2="5" stroke="' + route.options.originalStyle.color + '" fill="transparent" stroke-width="5" /></svg>' + ' ' + route.options.name);
216
- }
217
-
218
- this.fire('route_loaded', { route: route });
219
-
220
- if (++this._loadedCount === this._tracks.length) {
221
- this.fire('loaded');
222
- if (this.options.flyToBounds) {
223
- this._map.flyToBounds(this.getBounds(), { duration: 0.25, easeLinearity: 0.25, noMoveStart: true });
224
- }
225
- if (this.options.legend) {
226
- this._legend.addTo(this._map);
227
- }
228
- }
229
- },
230
-
231
- highlight: function(route, polyline) {
232
- polyline.setStyle(this.options.highlight);
233
- if (this.options.distanceMarkers) {
234
- polyline.addDistanceMarkers();
235
- }
236
- },
237
-
238
- unhighlight: function(route, polyline) {
239
- polyline.setStyle(route.options.originalStyle);
240
- if (this.options.distanceMarkers) {
241
- polyline.removeDistanceMarkers();
242
- }
243
- },
244
-
245
- _onRouteMouseOver: function(route, polyline) {
246
- if (!route.isSelected()) {
247
- this.highlight(route, polyline);
248
- if (this.options.legend) {
249
- this.setSelection(route);
250
- L.DomUtil.get('legend_' + route._leaflet_id).parentNode.previousSibling.click();
251
- }
252
- }
253
- this.fire('route_mouseover', { route: route, polyline: polyline });
254
- },
255
-
256
- _onRouteMouseOut: function(route, polyline) {
257
- if (!route.isSelected()) {
258
- this.unhighlight(route, polyline);
259
- }
260
- this.fire('route_mouseout', { route: route, polyline: polyline });
261
- },
262
-
263
- _onRouteClick: function(route, polyline) {
264
- this.setSelection(route);
265
- },
266
-
267
- _onRouteSelected: function(route, polyline) {
268
- if (!route.isSelected()) {
269
- this.unhighlight(route, polyline);
270
- }
271
- },
272
-
273
- _onSelectionChanged: function(e) {
274
- var elevation = this._elevation;
275
- var eleDiv = elevation.getContainer();
276
- var route = this.getSelection();
277
-
278
- elevation.clear();
279
-
280
- if (route && route.isSelected()) {
281
- if (!eleDiv) {
282
- elevation.addTo(this._map);
283
- }
284
- route.getLayers().forEach(function(layer) {
285
- if (layer instanceof L.Polyline) {
286
- elevation.addData(layer, false);
287
- layer.bringToFront();
288
- }
289
- });
290
- } else {
291
- if (eleDiv) {
292
- elevation.remove();
293
- }
294
- }
295
- },
296
-
297
- _onLegendSelected: function(e) {
298
- var parent = e.input.closest('.leaflet-control-layers-list');
299
- var route = e.layer;
300
-
301
- if (!route.isSelected()) {
302
- this.setSelection(route);
303
- for (var i in route._layers) {
304
- this.highlight(route, route._layers[i]);
305
- }
306
- this._map.flyToBounds(e.layer.getBounds());
307
- }
308
-
309
- parent.scroll({ top: (e.input.offsetTop - parent.offsetTop) || 0, behavior: 'smooth' });
310
-
311
- this._layers.eachLayer(layer => {
312
- var legend = L.DomUtil.get('legend_' + layer._leaflet_id);
313
- legend.querySelector("line").style.stroke = layer.isSelected() ? this.options.highlight.color : "";
314
- legend.parentNode.style.fontWeight = layer.isSelected() ? "700" : "";
315
- });
316
- },
317
-
318
- _uniqueColors: function(count) {
319
- return count === 1 ? ['#0000ff'] : new Array(count).fill(null).map((_,i) => this._hsvToHex(i * (1 / count), 1, 0.7));
320
- },
321
-
322
- _hsvToHex: function(h, s, v) {
323
- var i = Math.floor(h * 6);
324
- var f = h * 6 - i;
325
- var p = v * (1 - s);
326
- var q = v * (1 - f * s);
327
- var t = v * (1 - (1 - f) * s);
328
- var rgb = { 0: [v, t, p], 1: [q, v, p], 2: [p, v, t], 3: [p, q, v], 4: [t, p, v], 5: [v, p, q] }[i % 6];
329
- return rgb.map(d => d * 255).reduce((hex, byte) => hex + ((byte >> 4) & 0x0F).toString(16) + (byte & 0x0F).toString(16), "#");
330
- },
331
-
332
- removeFrom: function(map) {
333
- this._layers.removeFrom(map);
334
- },
335
-
336
- });
337
-
338
- L.GpxGroup.include(L.Mixin.Events);
339
- L.GpxGroup.include(L.Mixin.Selection);
340
-
1
+ /*
2
+ * https://github.com/adoroszlai/joebed/tree/gh-pages
3
+ *
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2014- Doroszlai Attila, 2019- Raruto
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ * this software and associated documentation files (the "Software"), to deal in
10
+ * the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
+ * the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+ L.Mixin.Selectable = {
27
+ includes: L.Mixin.Events,
28
+
29
+ setSelected: function(s) {
30
+ var selected = !!s;
31
+ if (this._selected !== selected) {
32
+ this._selected = selected;
33
+ this.fire('selected');
34
+ }
35
+ },
36
+
37
+ isSelected: function() {
38
+ return !!this._selected;
39
+ },
40
+ };
41
+
42
+ L.Mixin.Selection = {
43
+ includes: L.Mixin.Events,
44
+
45
+ getSelection: function() {
46
+ return this._selected;
47
+ },
48
+
49
+ setSelection: function(item) {
50
+ if (this._selected === item) {
51
+ if (item !== null) {
52
+ item.setSelected(!item.isSelected());
53
+ if (!item.isSelected()) {
54
+ this._selected = null;
55
+ }
56
+ }
57
+ } else {
58
+ if (this._selected) {
59
+ this._selected.setSelected(false);
60
+ }
61
+ this._selected = item;
62
+ if (this._selected) {
63
+ this._selected.setSelected(true);
64
+ }
65
+ }
66
+ this.fire('selection_changed');
67
+ },
68
+ };
69
+
70
+ L.Control.LayersLegend = L.Control.Layers.extend({
71
+ _onInputClick: function() {
72
+ this._handlingClick = true;
73
+
74
+ this._layerControlInputs.reduceRight((_,input) => {
75
+ if (input.checked) {
76
+ this._map.fireEvent("legend_selected", {
77
+ layer: this._getLayer(input.layerId).layer,
78
+ input: input,
79
+ }, true);
80
+ return input;
81
+ }
82
+ }, 0);
83
+
84
+ this._handlingClick = false;
85
+
86
+ this._refocusOnMap();
87
+ }
88
+ });
89
+
90
+ L.control.layersLegend = (baseLayers, overlays, options) => new L.Control.LayersLegend(baseLayers, overlays, options);
91
+
92
+ L.GeoJSON.include(L.Mixin.Selectable);
93
+
94
+ L.GpxGroup = L.Class.extend({
95
+ options: {
96
+ highlight: {
97
+ color: '#ff0',
98
+ opacity: 1,
99
+ },
100
+ points: [],
101
+ points_options: {
102
+ icon: {
103
+ iconUrl: '../images/elevation-poi.png',
104
+ iconSize: [12, 12],
105
+ }
106
+ },
107
+ flyToBounds: true,
108
+ legend: false,
109
+ legend_options: {
110
+ position: "topright",
111
+ collapsed: false,
112
+ },
113
+ elevation: true,
114
+ elevation_options: {
115
+ theme: 'yellow-theme',
116
+ detached: true,
117
+ elevationDiv: '#elevation-div',
118
+ },
119
+ distanceMarkers: true,
120
+ distanceMarkers_options: {
121
+ lazy: true
122
+ },
123
+ },
124
+
125
+ initialize: function(tracks, options) {
126
+
127
+ L.Util.setOptions(this, options);
128
+
129
+ this._count = 0;
130
+ this._loadedCount = 0;
131
+ this._tracks = tracks;
132
+ this._layers = L.featureGroup();
133
+ this._markers = L.featureGroup();
134
+ this._elevation = L.control.elevation(this.options.elevation_options);
135
+ this._legend = L.control.layersLegend(null, null, this.options.legend_options);
136
+
137
+ this.options.points.forEach((poi) =>
138
+ L
139
+ .marker(poi.latlng, { icon: L.icon(this.options.points_options.icon) })
140
+ .bindTooltip(poi.name, { direction: 'auto' }).addTo(this._markers)
141
+ );
142
+
143
+ },
144
+
145
+ getBounds: function() {
146
+ return this._layers.getBounds();
147
+ },
148
+
149
+ addTo: function(map) {
150
+ this._layers.addTo(map);
151
+ this._markers.addTo(map);
152
+
153
+ this._map = map;
154
+
155
+ this.on('selection_changed', this._onSelectionChanged, this);
156
+ this._map.on('legend_selected', this._onLegendSelected, this);
157
+ this._tracks.forEach(this.addTrack, this);
158
+
159
+ },
160
+
161
+ addTrack: function(track) {
162
+ fetch(track)
163
+ .then(response => response.ok && response.text())
164
+ .then(text => this._elevation._parseFromString(text))
165
+ .then(geojson => {
166
+ if(geojson) {
167
+ geojson.name = geojson.name || (geojson[0] && geojson[0].properties.name) || track.split('/').pop().split('#')[0].split('?')[0];
168
+ this._loadRoute(geojson);
169
+ }
170
+ });
171
+ },
172
+
173
+ _loadRoute: function(data) {
174
+ if (!data) return;
175
+
176
+ var line_style = {
177
+ color: this._uniqueColors(this._tracks.length)[this._count++],
178
+ opacity: 0.75,
179
+ weight: 5,
180
+ distanceMarkers: this.options.distanceMarkers_options,
181
+ };
182
+
183
+ var route = L.geoJson(data, {
184
+ name: data.name || '',
185
+ style: (feature) => line_style,
186
+ distanceMarkers: line_style.distanceMarkers,
187
+ originalStyle: line_style,
188
+ filter: feature => feature.geometry.type != "Point",
189
+ });
190
+
191
+
192
+ this._elevation.import(this._elevation.__LGEOMUTIL).then(() => {
193
+ route.addTo(this._layers);
194
+
195
+ route.eachLayer((layer) => this._onEachRouteLayer(route, layer));
196
+ this._onEachRouteLoaded(route);
197
+ });
198
+
199
+ },
200
+
201
+ _onEachRouteLayer: function(route, layer) {
202
+ var polyline = layer;
203
+
204
+ route.on('selected', L.bind(this._onRouteSelected, this, route, polyline));
205
+
206
+ polyline.on('mouseover', L.bind(this._onRouteMouseOver, this, route, polyline));
207
+ polyline.on('mouseout', L.bind(this._onRouteMouseOut, this, route, polyline));
208
+ polyline.on('click', L.bind(this._onRouteClick, this, route, polyline));
209
+
210
+ polyline.bindTooltip(route.options.name, { direction: 'auto', sticky: true, });
211
+ },
212
+
213
+ _onEachRouteLoaded: function(route) {
214
+ if (this.options.legend) {
215
+ this._legend.addBaseLayer(route, '<svg id="legend_' + route._leaflet_id + '" width="25" height="10" version="1.1" xmlns="http://www.w3.org/2000/svg">' + '<line x1="0" x2="50" y1="5" y2="5" stroke="' + route.options.originalStyle.color + '" fill="transparent" stroke-width="5" /></svg>' + ' ' + route.options.name);
216
+ }
217
+
218
+ this.fire('route_loaded', { route: route });
219
+
220
+ if (++this._loadedCount === this._tracks.length) {
221
+ this.fire('loaded');
222
+ if (this.options.flyToBounds) {
223
+ this._map.flyToBounds(this.getBounds(), { duration: 0.25, easeLinearity: 0.25, noMoveStart: true });
224
+ }
225
+ if (this.options.legend) {
226
+ this._legend.addTo(this._map);
227
+ }
228
+ }
229
+ },
230
+
231
+ highlight: function(route, polyline) {
232
+ polyline.setStyle(this.options.highlight);
233
+ if (this.options.distanceMarkers) {
234
+ polyline.addDistanceMarkers();
235
+ }
236
+ },
237
+
238
+ unhighlight: function(route, polyline) {
239
+ polyline.setStyle(route.options.originalStyle);
240
+ if (this.options.distanceMarkers) {
241
+ polyline.removeDistanceMarkers();
242
+ }
243
+ },
244
+
245
+ _onRouteMouseOver: function(route, polyline) {
246
+ if (!route.isSelected()) {
247
+ this.highlight(route, polyline);
248
+ if (this.options.legend) {
249
+ this.setSelection(route);
250
+ L.DomUtil.get('legend_' + route._leaflet_id).parentNode.previousSibling.click();
251
+ }
252
+ }
253
+ this.fire('route_mouseover', { route: route, polyline: polyline });
254
+ },
255
+
256
+ _onRouteMouseOut: function(route, polyline) {
257
+ if (!route.isSelected()) {
258
+ this.unhighlight(route, polyline);
259
+ }
260
+ this.fire('route_mouseout', { route: route, polyline: polyline });
261
+ },
262
+
263
+ _onRouteClick: function(route, polyline) {
264
+ this.setSelection(route);
265
+ },
266
+
267
+ _onRouteSelected: function(route, polyline) {
268
+ if (!route.isSelected()) {
269
+ this.unhighlight(route, polyline);
270
+ }
271
+ },
272
+
273
+ _onSelectionChanged: function(e) {
274
+ var elevation = this._elevation;
275
+ var eleDiv = elevation.getContainer();
276
+ var route = this.getSelection();
277
+
278
+ elevation.clear();
279
+
280
+ if (route && route.isSelected()) {
281
+ if (!eleDiv) {
282
+ elevation.addTo(this._map);
283
+ }
284
+ route.getLayers().forEach(function(layer) {
285
+ if (layer instanceof L.Polyline) {
286
+ elevation.addData(layer, false);
287
+ layer.bringToFront();
288
+ }
289
+ });
290
+ } else {
291
+ if (eleDiv) {
292
+ elevation.remove();
293
+ }
294
+ }
295
+ },
296
+
297
+ _onLegendSelected: function(e) {
298
+ var parent = e.input.closest('.leaflet-control-layers-list');
299
+ var route = e.layer;
300
+
301
+ if (!route.isSelected()) {
302
+ this.setSelection(route);
303
+ for (var i in route._layers) {
304
+ this.highlight(route, route._layers[i]);
305
+ }
306
+ this._map.flyToBounds(e.layer.getBounds());
307
+ }
308
+
309
+ parent.scroll({ top: (e.input.offsetTop - parent.offsetTop) || 0, behavior: 'smooth' });
310
+
311
+ this._layers.eachLayer(layer => {
312
+ var legend = L.DomUtil.get('legend_' + layer._leaflet_id);
313
+ legend.querySelector("line").style.stroke = layer.isSelected() ? this.options.highlight.color : "";
314
+ legend.parentNode.style.fontWeight = layer.isSelected() ? "700" : "";
315
+ });
316
+ },
317
+
318
+ _uniqueColors: function(count) {
319
+ return count === 1 ? ['#0000ff'] : new Array(count).fill(null).map((_,i) => this._hsvToHex(i * (1 / count), 1, 0.7));
320
+ },
321
+
322
+ _hsvToHex: function(h, s, v) {
323
+ var i = Math.floor(h * 6);
324
+ var f = h * 6 - i;
325
+ var p = v * (1 - s);
326
+ var q = v * (1 - f * s);
327
+ var t = v * (1 - (1 - f) * s);
328
+ var rgb = { 0: [v, t, p], 1: [q, v, p], 2: [p, v, t], 3: [p, q, v], 4: [t, p, v], 5: [v, p, q] }[i % 6];
329
+ return rgb.map(d => d * 255).reduce((hex, byte) => hex + ((byte >> 4) & 0x0F).toString(16) + (byte & 0x0F).toString(16), "#");
330
+ },
331
+
332
+ removeFrom: function(map) {
333
+ this._layers.removeFrom(map);
334
+ },
335
+
336
+ });
337
+
338
+ L.GpxGroup.include(L.Mixin.Events);
339
+ L.GpxGroup.include(L.Mixin.Selection);
340
+
341
341
  L.gpxGroup = (tracks, options) => new L.GpxGroup(tracks, options);