@raruto/leaflet-elevation 2.0.3 → 2.0.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 CHANGED
@@ -197,10 +197,10 @@ There are multiple options to achieve this:
197
197
  * check out [this example](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-theme.html)
198
198
  * Or add the following lines for custom colors.
199
199
  ```css
200
- .elevation-control.elevation .area {
200
+ .elevation-control .area {
201
201
  fill: red;
202
202
  }
203
- .elevation-control.elevation .background {
203
+ .elevation-control .background {
204
204
  background-color: white;
205
205
  ```
206
206
  </details>
@@ -244,7 +244,7 @@ var map = L.map('map', {
244
244
  - https://walkaholic.me/map
245
245
 
246
246
  </details>
247
-
247
+
248
248
  _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Integration](https://github.com/faunalia/trackprofile2web)_
249
249
 
250
250
  ---
@@ -260,3 +260,5 @@ _Related: [Leaflet-UI presets](https://github.com/raruto/leaflet-ui), [QGIS Inte
260
260
  **Contributors:** [MrMufflon](https://github.com/MrMufflon/Leaflet.Elevation), [HostedDinner](https://github.com/HostedDinner/Leaflet.Elevation), [ADoroszlai](http://ADoroszlai.github.io/joebed/), [Raruto](https://github.com/Raruto/leaflet-elevation)
261
261
 
262
262
  ---
263
+
264
+ Check out [CONTRIBUTING.md](.github/CONTRIBUTING.md) file for more information on supporting the development of this library.
@@ -11,57 +11,44 @@
11
11
  /* prevent overlapping the .elevation-detached chart */
12
12
  }
13
13
 
14
- .elevation-detached {
15
- font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
16
- height: auto;
17
- width: 100%;
18
- position: relative;
19
- z-index: 0;
20
- }
21
-
22
- .elevation-detached .elevation {
23
- width: 100%;
24
- }
25
-
26
- .elevation-detached .background {
27
- max-width: 100%;
28
- }
29
-
30
- .elevation-control.elevation .background {
14
+ .elevation-control .background {
31
15
  background-color: var(--ele-bg, rgba(70, 130, 180, 0.2));
32
16
  border-radius: 5px;
33
17
  overflow: visible;
34
18
  display: block;
35
19
  touch-action: none;
36
20
  user-select: none;
21
+ max-width: 100%;
37
22
  }
38
23
 
39
- .elevation-control.elevation .axis .tick,
40
- .elevation-control.elevation .axis .domain {
24
+ .elevation-control .grid,
25
+ .elevation-control .area > foreignObject,
26
+ .elevation-control .axis,
27
+ .elevation-control .tooltip,
28
+ .height-focus.line {
41
29
  pointer-events: none;
42
30
  }
43
31
 
44
- .elevation-control.elevation .axis line,
45
- .elevation-control.elevation .axis path {
32
+ .elevation-control .axis line,
33
+ .elevation-control .axis path {
46
34
  stroke: var(--ele-axis, #2D1130);
47
35
  stroke-width: 1;
48
36
  fill: none;
49
37
  }
50
38
 
51
- .elevation-control.elevation .grid .tick line {
39
+ .elevation-control .grid .tick line {
52
40
  stroke: var(--ele-grid, #EEE);
53
41
  stroke-width: 1px;
54
42
  shape-rendering: crispEdges;
55
43
  }
56
44
 
57
- .elevation-control.elevation .grid path {
45
+ .elevation-control .grid path {
58
46
  stroke-width: 0;
59
- pointer-events: none;
60
47
  }
61
48
 
62
- .elevation-control.elevation .axis text,
63
- .elevation-control.elevation .legend text,
64
- .elevation-control.elevation .point text {
49
+ .elevation-control .axis text,
50
+ .elevation-control .legend text,
51
+ .elevation-control .point text {
65
52
  fill: #000;
66
53
  font-weight: 700;
67
54
  paint-order: stroke fill;
@@ -69,181 +56,120 @@
69
56
  stroke-width: 2px
70
57
  }
71
58
 
72
- .elevation-control.elevation .y.axis text {
59
+ .elevation-control .y.axis text {
73
60
  text-anchor: end;
74
61
  }
75
62
 
76
- .elevation-control.elevation .area {
63
+ .elevation-control .area {
77
64
  fill: var(--ele-area, #4682B4);
78
65
  stroke: var(--ele-stroke, #000);
79
66
  stroke-width: 1.2;
80
67
  paint-order: stroke fill;
81
68
  }
82
69
 
83
- .elevation-detached .elevation-control.elevation .area {
84
- fill-opacity: var(--ele-alpha, 0.8);
85
- }
86
-
87
- .elevation-control.elevation .horizontal-drag-line {
88
- stroke: transparent;
70
+ .elevation-control .horizontal-drag-line {
89
71
  cursor: row-resize;
90
- stroke-width: 1.1;
72
+ stroke: transparent;
91
73
  stroke-dasharray: 5;
74
+ stroke-width: 1.1;
92
75
  }
93
76
 
94
- .elevation-control.elevation .active .horizontal-drag-line {
77
+ .elevation-control .active .horizontal-drag-line {
95
78
  stroke: #000;
96
79
  }
97
80
 
98
- .elevation-control.elevation .horizontal-drag-label {
99
- font-weight: 700;
81
+ .elevation-control .horizontal-drag-label {
100
82
  fill: #000;
83
+ font-weight: 700;
101
84
  paint-order: stroke;
102
85
  stroke: #FFF;
103
86
  stroke-width: 2px;
104
- pointer-events: none;
105
87
  }
106
88
 
107
- .elevation-control.elevation .ruler {
108
- cursor: row-resize;
89
+ .elevation-control .ruler {
109
90
  color: #000;
91
+ cursor: row-resize;
110
92
  }
111
93
 
112
- .elevation-control.elevation .mouse-focus-line {
94
+ .elevation-control .mouse-focus-line {
113
95
  stroke: #000;
114
96
  stroke-width: 1;
115
- pointer-events: none;
116
97
  }
117
98
 
118
- .elevation-control.elevation .mouse-focus-label-rect {
99
+ .elevation-control .mouse-focus-label-rect {
119
100
  fill: #000;
120
101
  fill-opacity: 0.75;
121
- pointer-events: none;
122
102
  stroke-width: 1;
123
103
  stroke: #444;
124
104
  }
125
105
 
126
- .elevation-control.elevation .mouse-focus-label-text {
106
+ .elevation-control .mouse-focus-label-text {
127
107
  fill: #FFF;
128
- pointer-events: none;
129
108
  font-size: 10px;
130
109
  }
131
110
 
132
- .elevation-control.elevation .brush .overlay {
111
+ .elevation-control .brush .overlay {
133
112
  cursor: unset;
134
113
  }
135
114
 
136
- .elevation-control.elevation .brush .selection {
115
+ .elevation-control .brush .selection {
137
116
  fill: var(--ele-brush, rgba(23, 74, 117, 0.4));
138
117
  stroke: none;
139
118
  fill-opacity: unset;
140
119
  }
141
120
 
142
- .elevation-control.elevation .elevation-toggle {
143
- cursor: pointer;
144
- box-shadow: 0 1px 7px rgba(0, 0, 0, 0.4);
145
- border-radius: 5px;
146
- width: 36px;
147
- height: 36px;
148
- background-color: #F8F8F9;
149
- }
150
-
151
121
  .elevation-summary {
152
122
  font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
153
123
  font-size: 12px;
154
- margin: 0 auto;
124
+ margin: var(--ele-sum-margin, 0 auto);
125
+ text-shadow: var(--ele-sum-shadow, 1px 0 0 #FFF, -1px 0 0 #FFF, 0 1px 0 #FFF, 0 -1px 0 #FFF, 1px 1px #FFF, -1px -1px 0 #FFF, 1px -1px 0 #FFF, -1px 1px 0 #FFF);
155
126
  }
156
127
 
157
- .leaflet-control-container .elevation-summary {
158
- text-shadow:
159
- 1.5px 0 0 #FFF,
160
- -1.5px 0 0 #FFF,
161
- 0 1.5px 0 #FFF,
162
- 0 -1.5px 0 #FFF,
163
- 1px 1px #FFF,
164
- -1px -1px 0 #FFF,
165
- 1px -1px 0 #FFF,
166
- -1px 1px 0 #FFF;
128
+ .elevation-summary>span:not(:last-child):after {
129
+ content: var(--ele-sum-sep, '');
167
130
  }
168
131
 
169
- .elevation-detached .elevation-summary {
170
- margin: 0 45px;
171
- }
172
-
173
- .elevation-summary.multiline-summary {
174
- margin-right: 30px;
175
- }
176
-
177
- .elevation-detached .elevation-summary.multiline-summary {
178
- margin-bottom: 12px;
179
- margin-top: 12px;
180
- line-height: 2;
181
- }
182
-
183
- .elevation-summary.inline-summary>span:not(:last-child):after {
184
- content: "\0020\2014\0020";
185
- }
186
-
187
- .elevation-summary.multiline-summary>span {
132
+ .multiline-summary>span {
188
133
  display: block;
189
134
  }
190
135
 
191
- .elevation-summary.multiline-summary .download {
136
+ .multiline-summary .download {
192
137
  float: right;
193
- margin-top: -2.5em;
138
+ margin-top: -3em;
139
+ margin-right: 2em;
194
140
  font-weight: bold;
195
141
  font-size: 1.2em;
196
142
  }
197
143
 
198
- .elevation-detached .elevation-summary.multiline-summary .download {
199
- margin-top: -3.5em;
200
- }
201
-
202
144
  .elevation-summary .summaryvalue {
203
145
  font-weight: bold;
204
146
  }
205
147
 
206
- .elevation-control.elevation-collapsed .background,
207
- .elevation-control.elevation-collapsed .elevation-summary {
208
- display: none;
209
- }
210
-
211
- .elevation-control.elevation-collapsed .elevation-toggle {
212
- display: block;
213
- }
214
-
215
- .elevation-control.elevation .elevation-toggle-icon {
216
- background: var(--ele-icon, url(../images/elevation-lime.svg)) no-repeat center center;
217
- }
218
-
219
- .elevation-control.elevation.elevation-expanded .elevation-toggle-icon.close-button {
220
- background: transparent;
221
- position: absolute;
148
+ .elevation-toggle-icon {
149
+ background: var(--ele-toggle-bg, var(--ele-icon, url(../images/elevation-lime.svg)) no-repeat center center);
150
+ background-color: #fff;
222
151
  right: 5px;
223
152
  top: 5px;
224
- height: 20px;
225
- width: 20px;
153
+ height: var(--ele-toggle-size, 36px);
154
+ width: var(--ele-toggle-size, 36px);
155
+ cursor: pointer;
156
+ box-shadow: 0 1px 7px rgba(0, 0, 0, 0.4);
157
+ border-radius: 5px;
158
+ display: inline-block;
159
+ position: var(--ele-toggle-pos, relative);
226
160
  }
227
161
 
228
- .elevation-control.elevation.elevation-expanded .elevation-toggle-icon.close-button:before {
162
+ .elevation-toggle-icon:before {
229
163
  content: '\2716';
230
- display: inline-block;
164
+ display: var(--ele-close-btn, none);
231
165
  color: #000;
232
- position: absolute;
233
- left: 0;
234
- right: 0;
235
- top: 0;
236
- bottom: 0;
166
+ width: 100%;
237
167
  line-height: 20px;
238
168
  text-align: center;
239
169
  font-weight: bold;
240
170
  font-size: 15px;
241
171
  }
242
172
 
243
- .elevation-control.elevation g.area > foreignObject {
244
- pointer-events: none;
245
- }
246
-
247
173
  .leaflet-elevation-pane .height-focus,
248
174
  .leaflet-overlay-pane .height-focus {
249
175
  stroke: #000;
@@ -252,7 +178,6 @@
252
178
 
253
179
  .leaflet-elevation-pane .height-focus.line,
254
180
  .leaflet-overlay-pane .height-focus.line {
255
- pointer-events: none;
256
181
  stroke-width: 2;
257
182
  }
258
183
 
@@ -272,22 +197,73 @@
272
197
  width: 100%;
273
198
  height: 100%;
274
199
  display: inline-block;
200
+ background: var(--ele-marker) no-repeat center center / contain;
275
201
  }
276
202
 
277
- .elevation-waypoint-icon:before {
278
- background: url(../images/elevation-pushpin.svg) no-repeat center center / contain;
203
+ .elevation-polyline {
204
+ stroke: var(--ele-poly, var(--ele-area, #000));
205
+ 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);
279
206
  }
280
207
 
281
- .elevation-position-icon:before {
282
- background: url(../images/elevation-position.svg) no-repeat center center / contain;
208
+ /* CHART STATES /////////////////////////////////////////////////// */
209
+
210
+ .elevation-detached {
211
+ font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
212
+ height: auto;
213
+ width: 100%;
214
+ position: relative;
215
+ z-index: 0;
283
216
  }
284
217
 
285
- .elevation-polyline {
286
- stroke: var(--ele-poly, var(--ele-area, #000));
287
- 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);
218
+ .elevation-detached .area {
219
+ fill-opacity: var(--ele-alpha, 0.8);
220
+ }
221
+
222
+ .elevation-detached.elevation-collapsed .elevation-summary {
223
+ display: block;
224
+ }
225
+
226
+ .elevation-detached.elevation-collapsed .elevation-toggle-icon {
227
+ top: 5px;
228
+ right: 9px;
229
+ bottom: 5px;
230
+ margin: auto;
231
+ }
232
+
233
+ .elevation-control.elevation-collapsed > * {
234
+ display: none;
235
+ }
236
+
237
+ .elevation-control.elevation-collapsed > .elevation-toggle-icon {
238
+ display: inline-block;
239
+ }
240
+
241
+ .elevation-detached {
242
+ --ele-sum-margin: 12px 35px;
243
+ --ele-sum-shadow: none;
244
+ --ele-toggle-pos: absolute;
245
+ }
246
+
247
+ .elevation-expanded {
248
+ --ele-close-btn: inline-block;
249
+ --ele-toggle-bg: transparent;
250
+ --ele-toggle-pos: absolute;
251
+ --ele-toggle-size: 20px;
252
+ }
253
+
254
+ .inline-summary {
255
+ --ele-sum-sep: "\0020\2014\0020";
256
+ }
257
+
258
+ .elevation-waypoint-icon {
259
+ --ele-marker: url(../images/elevation-pushpin.svg);
260
+ }
261
+
262
+ .elevation-position-icon {
263
+ --ele-marker: url(../images/elevation-position.svg);
288
264
  }
289
265
 
290
- /* LIME THEME //////////////////////////////////////////////// */
266
+ /* LIME THEME ///////////////////////////////////////////////////// */
291
267
 
292
268
  .lime-theme {
293
269
  --ele-bg: rgba(156, 194, 34, 0.2);
@@ -308,7 +284,7 @@
308
284
  --ele-icon: url(../images/elevation-steelblue.svg);
309
285
  }
310
286
 
311
- /* PURPLE THEME //////////////////////////////////////////////// */
287
+ /* PURPLE THEME /////////////////////////////////////////////////// */
312
288
 
313
289
  .purple-theme {
314
290
  --ele-bg: rgba(115, 44, 123, 0.2);
@@ -317,19 +293,19 @@
317
293
  --ele-icon: url(../images/elevation-purple.svg);
318
294
  }
319
295
 
320
- /* YELLOW THEME //////////////////////////////////////////////// */
296
+ /* YELLOW THEME /////////////////////////////////////////////////// */
321
297
 
322
298
  .yellow-theme {
323
299
  --ele-area: #FF0;
324
300
  }
325
301
 
326
- /* RED THEME //////////////////////////////////////////////// */
302
+ /* RED THEME ////////////////////////////////////////////////////// */
327
303
 
328
304
  .red-theme {
329
305
  --ele-area: #F00;
330
306
  }
331
307
 
332
- /* MAGENTA THEME //////////////////////////////////////////////// */
308
+ /* MAGENTA THEME ////////////////////////////////////////////////// */
333
309
 
334
310
  .magenta-theme {
335
311
  --ele-bg: rgba(255, 255, 255, 0.47);
@@ -345,7 +321,7 @@
345
321
  --ele-circle: #fff;
346
322
  }
347
323
 
348
- .elevation-detached .lightblue-theme.elevation-control.elevation .area {
324
+ .elevation-detached.lightblue-theme .area {
349
325
  stroke: #3366CC;
350
326
  }
351
327
 
@@ -245,10 +245,11 @@
245
245
 
246
246
  var Options = {
247
247
  autofitBounds: true,
248
- autohide: !L.Browser.mobile,
248
+ autohide: false,
249
249
  autohideMarker: true,
250
250
  almostover: true,
251
251
  altitude: true,
252
+ closeBtn: true,
252
253
  collapsed: false,
253
254
  detached: true,
254
255
  distance: true,
@@ -260,6 +261,7 @@
260
261
  imperial: false,
261
262
  legend: true,
262
263
  handlers: [],
264
+ hotline: 'elevation',
263
265
  marker: 'elevation-line',
264
266
  markerIcon: L.divIcon({
265
267
  className: 'elevation-position-marker',
@@ -309,7 +311,13 @@
309
311
  zFollow: false,
310
312
  zooming: !L.Browser.Mobile,
311
313
 
312
- // Quite uncommon and undocumented options (quite useless)
314
+ // Quite uncommon and undocumented options
315
+ margins: { top: 30, right: 30, bottom: 30, left: 40 },
316
+ height: (screen.height * 0.3) || 200,
317
+ width: (screen.width * 0.6) || 600,
318
+ xTicks: undefined,
319
+ yTicks: undefined,
320
+
313
321
  decimalsX: 2,
314
322
  decimalsY: 0,
315
323
  forceAxisBounds: false,
@@ -317,13 +325,6 @@
317
325
  skipNullZCoords: false,
318
326
  yAxisMax: undefined,
319
327
  yAxisMin: undefined,
320
-
321
- // Probably no longer functional as expected (internally overwritten)
322
- margins: { top: 30, right: 30, bottom: 30, left: 40 },
323
- height: 200,
324
- width: 600,
325
- xTicks: undefined,
326
- yTicks: undefined,
327
328
  };
328
329
 
329
330
  const Elevation = L.Control.Elevation = L.Control.extend({
@@ -331,12 +332,13 @@
331
332
  includes: L.Evented ? L.Evented.prototype : L.Mixin.Events,
332
333
 
333
334
  options: Options,
334
- __mileFactor: 0.621371, // 1 km = (0.621371 mi)
335
- __footFactor: 3.28084, // 1 m = (3.28084 ft)
335
+ __mileFactor: 0.621371, // 1 km = (0.621371 mi)
336
+ __footFactor: 3.28084, // 1 m = (3.28084 ft)
336
337
  __D3: 'https://unpkg.com/d3@6.5.0/dist/d3.min.js',
337
338
  __TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.6.0/dist/togeojson.umd.js',
338
339
  __LGEOMUTIL: 'https://unpkg.com/leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js',
339
340
  __LALMOSTOVER: 'https://unpkg.com/leaflet-almostover@1.0.1/src/leaflet.almostover.js',
341
+ __LHOTLINE: '../libs/leaflet-hotline.min.js',
340
342
  __LDISTANCEM: '../libs/leaflet-distance-marker.min.js',
341
343
  __LCHART: '../src/components/chart.js',
342
344
  __LMARKER: '../src/components/marker.js',
@@ -361,9 +363,9 @@
361
363
  */
362
364
  addTo: function(map) {
363
365
  if (this.options.detached) {
364
- let eleDiv = this._initElevationDiv();
365
- if (!eleDiv.isConnected) insert(map.getContainer(), eleDiv, 'afterend');
366
- append(eleDiv, this.onAdd(map));
366
+ let parent = select(this.options.elevationDiv);
367
+ let eleDiv = this.onAdd(map);
368
+ parent ? append(parent, eleDiv) : insert(map.getContainer(), eleDiv, 'afterend');
367
369
  } else {
368
370
  L.Control.prototype.addTo.call(this, map);
369
371
  }
@@ -545,7 +547,9 @@
545
547
  onAdd: function(map) {
546
548
  this._map = map;
547
549
 
548
- let container = this._container = create("div", "elevation-control elevation " + this.options.theme + " " + (this.options.detached ? '' : 'leaflet-control'));
550
+ let container = this._container = create("div", "elevation-control " + this.options.theme + " " + (this.options.detached ? 'elevation-detached' : 'leaflet-control'), this.options.detached ? { id: 'elevation-' + randomId() } : {});
551
+
552
+ if (!this.eleDiv) this.eleDiv = container;
549
553
 
550
554
  let modules = [
551
555
  "Distance",
@@ -737,19 +741,35 @@
737
741
  }
738
742
  },
739
743
 
740
- /**
741
- * Adds the control to the given "detached" div.
742
- */
743
- _initElevationDiv: function() {
744
- let eleDiv = select(this.options.elevationDiv);
745
- if (!eleDiv) {
746
- this.options.elevationDiv = '#elevation-div_' + randomId();
747
- eleDiv = create('div', 'leaflet-control elevation elevation-div', { id: this.options.elevationDiv.substr(1) });
748
- }
749
- if (this.options.detached) {
750
- replaceClass(eleDiv, 'leaflet-control', 'elevation-detached');
744
+ _initHotLine: function(map, layer) {
745
+ if (this.options.hotline) {
746
+ let prop = typeof this.options.hotline == 'string' ? this.options.hotline : 'elevation';
747
+ this.import(this.__LHOTLINE)
748
+ .then(() => {
749
+ this._hotline = L.featureGroup();
750
+ layer.setStyle({opacity: 0});
751
+ layer.eachLayer((trkseg) => {
752
+ if(trkseg.feature.geometry.type != "Point") {
753
+ let geo = L.geoJson(trkseg.toGeoJSON(), { coordsToLatLng: (coords) => L.latLng(coords[0], coords[1], coords[2])});
754
+ L.hotline(geo.toGeoJSON().features[0].geometry.coordinates, {
755
+ min: isFinite(this.track_info[prop + '_min']) ? this.track_info[prop + '_min'] : 0,
756
+ max: isFinite(this.track_info[prop + '_max']) ? this.track_info[prop + '_max'] : 1,
757
+ palette: {
758
+ 0.0: '#008800',
759
+ 0.5: '#ffff00',
760
+ 1.0: '#ff0000'
761
+ },
762
+ weight: 5,
763
+ outlineColor: '#000000',
764
+ outlineWidth: 1
765
+ }).addTo(this._hotline);
766
+ }
767
+ });
768
+ if (map) {
769
+ this._hotline.addTo(map);
770
+ }
771
+ });
751
772
  }
752
- return this.eleDiv = eleDiv;
753
773
  },
754
774
 
755
775
  /**
@@ -765,11 +785,13 @@
765
785
  control._circleMarkers.addTo(map);
766
786
  map.once('layeradd', (e) => control.options.autofitBounds && control.fitBounds(layer.getBounds()));
767
787
  if (!L.Browser.mobile) {
788
+ control._initHotLine(map, layer);
768
789
  control._initAlmostOverHandler(map, layer);
769
790
  control._initDistanceMarkers(map, layer);
770
791
  } else if (control.options.polyline) {
771
792
  layer.addTo(map);
772
793
  }
794
+ map.invalidateSize();
773
795
  } else {
774
796
  console.warn("Undefined elevation map object"); }
775
797
  },
@@ -779,6 +801,7 @@
779
801
  */
780
802
  _collapse: function() {
781
803
  replaceClass(this._container, 'elevation-expanded', 'elevation-collapsed');
804
+ if (this._map) this._map.invalidateSize();
782
805
  },
783
806
 
784
807
  /*
@@ -786,6 +809,7 @@
786
809
  */
787
810
  _expand: function() {
788
811
  replaceClass(this._container, 'elevation-collapsed', 'elevation-expanded');
812
+ if (this._map) this._map.invalidateSize();
789
813
  },
790
814
 
791
815
  /**
@@ -795,7 +819,7 @@
795
819
  let oldProto = L.Canvas.prototype._fillStroke;
796
820
  let control = this;
797
821
 
798
- let theme = this.options.theme.replace('-theme', '');
822
+ let theme = this.options.theme.split(' ')[0].replace('-theme', '');
799
823
  let color = Colors[theme] || {};
800
824
 
801
825
  L.Canvas.include({
@@ -980,23 +1004,19 @@
980
1004
  .disableScrollPropagation(container);
981
1005
  }
982
1006
 
983
- if (!this.options.detached) {
984
- let link = this._button = create('a', "elevation-toggle elevation-toggle-icon" + (this.options.autohide ? "" : " close-button"), { href: '#', title: L._('Elevation') }, container);
1007
+ this.options.collapsed ? this._collapse() : this._expand();
985
1008
 
986
- if (this.options.collapsed) {
987
- this._collapse();
988
- if (this.options.autohide) {
989
- on(container, 'mouseover', this._expand, this);
990
- on(container, 'mouseout', this._collapse, this);
991
- } else {
992
- on(link, 'click', L.DomEvent.stop);
993
- on(link, 'click', this._toggle, this);
994
- }
995
-
996
- on(link, 'focus', this._toggle, this);
1009
+ if (this.options.autohide) {
1010
+ on(container, 'mouseover', this._expand, this);
1011
+ on(container, 'mouseout', this._collapse, this);
1012
+ this._map.on('click', this._collapse, this);
1013
+ }
997
1014
 
998
- this._map.on('click', this._collapse, this);
999
- }
1015
+ if (this.options.closeBtn) {
1016
+ let link = this._button = create('a', "elevation-toggle-icon", { href: '#', title: L._('Elevation'), }, container);
1017
+ on(link, 'click', L.DomEvent.stop);
1018
+ on(link, 'click', this._toggle, this);
1019
+ on(link, 'focus', this._toggle, this);
1000
1020
  }
1001
1021
  },
1002
1022
 
@@ -1578,8 +1598,8 @@
1578
1598
  }
1579
1599
  if (this.options.downloadLink && this._downloadURL) { // TODO: generate dynamically file content instead of using static file urls.
1580
1600
  this._summary._container.innerHTML += '<span class="download"><a href="#">' + L._('Download') + '</a></span>';
1581
- select('.download a', this._summary._container).onclick = ({preventDefault}) => {
1582
- preventDefault();
1601
+ select('.download a', this._summary._container).onclick = (e) => {
1602
+ e.preventDefault();
1583
1603
  let event = { downloadLink: this.options.downloadLink, confirm: saveFile.bind(this, this._downloadURL) };
1584
1604
  if (this.options.downloadLink == 'modal' && typeof CustomEvent === "function") {
1585
1605
  document.dispatchEvent(new CustomEvent("eletrack_download", { detail: event }));