@raruto/leaflet-elevation 2.0.2 → 2.0.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.
@@ -60,6 +60,7 @@
60
60
  }
61
61
 
62
62
  .elevation-control.elevation .axis text,
63
+ .elevation-control.elevation .legend text,
63
64
  .elevation-control.elevation .point text {
64
65
  fill: #000;
65
66
  font-weight: 700;
@@ -186,9 +186,9 @@
186
186
  /**
187
187
  * Alias for some leaflet core functions
188
188
  */
189
- const { on, off } = L.DomEvent;
190
- const { throttle } = L.Util;
191
- const { hasClass } = L.DomUtil;
189
+ const { on, off } = L.DomEvent;
190
+ const { throttle, wrapNum } = L.Util;
191
+ const { hasClass } = L.DomUtil;
192
192
 
193
193
  /**
194
194
  * Limit floating point precision
@@ -236,6 +236,7 @@
236
236
  on: on,
237
237
  off: off,
238
238
  throttle: throttle,
239
+ wrapNum: wrapNum,
239
240
  hasClass: hasClass,
240
241
  round: round,
241
242
  clamp: clamp,
@@ -915,10 +916,6 @@
915
916
  .on('margins_updated', this._resizeChart, this);
916
917
 
917
918
 
918
- this.fire("elechart_axis");
919
-
920
- if (this.options.legend) this.fire("elechart_legend");
921
-
922
919
  this.fire("elechart_init");
923
920
 
924
921
  map
@@ -1526,7 +1523,6 @@
1526
1523
  _updateChart: function() {
1527
1524
  if (this._chart && this._container) {
1528
1525
  this.fire("elechart_axis");
1529
- this.fire("elechart_area");
1530
1526
 
1531
1527
  this._chart.update({ data: this._data, options: this.options });
1532
1528
 
@@ -1574,27 +1570,27 @@
1574
1570
  * Update chart summary.
1575
1571
  */
1576
1572
  _updateSummary: function() {
1577
- if (!this._summary) return;
1578
-
1579
- this._summary.reset();
1580
-
1581
- if (this.options.summary) {
1582
- this.fire("elechart_summary");
1583
- this._summary.update();
1573
+ if (this._summary) {
1574
+ this._summary.reset();
1575
+ if (this.options.summary) {
1576
+ this.fire("elechart_summary");
1577
+ this._summary.update();
1578
+ }
1579
+ if (this.options.downloadLink && this._downloadURL) { // TODO: generate dynamically file content instead of using static file urls.
1580
+ this._summary._container.innerHTML += '<span class="download"><a href="#">' + L._('Download') + '</a></span>';
1581
+ select('.download a', this._summary._container).onclick = ({preventDefault}) => {
1582
+ preventDefault();
1583
+ let event = { downloadLink: this.options.downloadLink, confirm: saveFile.bind(this, this._downloadURL) };
1584
+ if (this.options.downloadLink == 'modal' && typeof CustomEvent === "function") {
1585
+ document.dispatchEvent(new CustomEvent("eletrack_download", { detail: event }));
1586
+ } else if (this.options.downloadLink == 'link' || this.options.downloadLink === true) {
1587
+ event.confirm();
1588
+ }
1589
+ this.fire('eletrack_download', event);
1590
+ };
1591
+ }
1584
1592
  }
1585
- if (this.options.downloadLink && this._downloadURL) { // TODO: generate dynamically file content instead of using static file urls.
1586
- this._summary._container.innerHTML += '<span class="download"><a href="#">' + L._('Download') + '</a></span>';
1587
- select('.download a', this._summary._container).onclick = ({preventDefault}) => {
1588
- preventDefault();
1589
- let event = { downloadLink: this.options.downloadLink, confirm: saveFile.bind(this, this._downloadURL) };
1590
- if (this.options.downloadLink == 'modal' && typeof CustomEvent === "function") {
1591
- document.dispatchEvent(new CustomEvent("eletrack_download", { detail: event }));
1592
- } else if (this.options.downloadLink == 'link' || this.options.downloadLink === true) {
1593
- event.confirm();
1594
- }
1595
- this.fire('eletrack_download', event);
1596
- };
1597
- } },
1593
+ },
1598
1594
 
1599
1595
 
1600
1596
  /**