summaryrefslogtreecommitdiff
path: root/assets/static/vendor/leaflet-elevation/src/handlers/altitude.js
diff options
context:
space:
mode:
authorDennis Fink2026-11-03 23:18:23 +0100
committerDennis Fink2026-11-03 23:18:23 +0100
commitebe123a6d40bf17ab2a35f331fb08c8c0fc76a3a (patch)
tree441d3a817736e9db25d5c14aa3938c0392166160 /assets/static/vendor/leaflet-elevation/src/handlers/altitude.js
parent7f4de25eb8abca76a619bc70bb0fce7e8be36561 (diff)
downloaddennisfink.me-ebe123a6d40bf17ab2a35f331fb08c8c0fc76a3a.tar.gz
dennisfink.me-ebe123a6d40bf17ab2a35f331fb08c8c0fc76a3a.zip
Update vendored Leaflet Elevation and map dependencies
Diffstat (limited to 'assets/static/vendor/leaflet-elevation/src/handlers/altitude.js')
-rw-r--r--assets/static/vendor/leaflet-elevation/src/handlers/altitude.js156
1 files changed, 78 insertions, 78 deletions
diff --git a/assets/static/vendor/leaflet-elevation/src/handlers/altitude.js b/assets/static/vendor/leaflet-elevation/src/handlers/altitude.js
index b7fe6e3..5f6d6c8 100644
--- a/assets/static/vendor/leaflet-elevation/src/handlers/altitude.js
+++ b/assets/static/vendor/leaflet-elevation/src/handlers/altitude.js
@@ -1,78 +1,78 @@
-export function Altitude() {
-
- const _ = L.Control.Elevation.Utils;
-
- let opts = this.options;
- let altitude = {};
-
- let theme = opts.theme.split(' ')[0].replace('-theme', '');
- let color = _.Colors[theme] || {};
-
- opts.altitudeFactor = opts.imperial ? this.__footFactor : (opts.altitudeFactor || 1); // 1 m = (1 m)
- altitude.label = opts.imperial ? "ft" : opts.yLabel;
-
- return {
- name: 'altitude',
- required: this.options.slope,
- meta: 'z',
- unit: altitude.label,
- statsName: 'elevation',
- deltaMax: this.options.altitudeDeltaMax,
- clampRange: this.options.altitudeRange,
- // init: ({point}) => {
- // // "alt" property is generated inside "leaflet"
- // if ("alt" in point) point.meta.ele = point.alt;
- // },
- pointToAttr: (point, i) => {
- if ("alt" in point) point.meta.ele = point.alt; // "alt" property is generated inside "leaflet"
- return this._data[i].z *= opts.altitudeFactor;
- },
- stats: { max: _.iMax, min: _.iMin, avg: _.iAvg },
- grid: {
- axis : "y",
- position : "left",
- scale : "y" // this._chart._y,
- },
- scale: {
- axis : "y",
- position: "left",
- scale : "y", // this._chart._y,
- labelX : -3,
- labelY : -8,
- },
- path: {
- label : 'Altitude',
- scaleX : 'distance',
- scaleY : 'altitude',
- className : 'area',
- color : color.area || theme,
- strokeColor : opts.detached ? color.stroke : '#000',
- strokeOpacity: "1",
- fillOpacity : opts.detached ? (color.alpha || '0.8') : 1,
- preferCanvas : opts.preferCanvas,
- },
- tooltip: {
- name: 'y',
- chart: (item) => L._("y: ") + _.round(item[opts.yAttr], opts.decimalsY) + " " + altitude.label,
- marker: (item) => _.round(item[opts.yAttr], opts.decimalsY) + " " + altitude.label,
- order: 10,
- },
- summary: {
- "minele" : {
- label: "Min Elevation: ",
- value: (track, unit) => (track.elevation_min || 0).toFixed(2) + ' ' + unit,
- order: 30,
- },
- "maxele" : {
- label: "Max Elevation: ",
- value: (track, unit) => (track.elevation_max || 0).toFixed(2) + ' ' + unit,
- order: 31,
- },
- "avgele" : {
- label: "Avg Elevation: ",
- value: (track, unit) => (track.elevation_avg || 0).toFixed(2) + ' ' + unit,
- order: 32,
- },
- }
- };
-}
+export function Altitude() {
+
+ const _ = L.Control.Elevation.Utils;
+
+ let opts = this.options;
+ let altitude = {};
+
+ let theme = opts.theme.split(' ')[0].replace('-theme', '');
+ let color = _.Colors[theme] || {};
+
+ opts.altitudeFactor = opts.imperial ? this.__footFactor : (opts.altitudeFactor || 1); // 1 m = (1 m)
+ altitude.label = opts.imperial ? "ft" : opts.yLabel;
+
+ return {
+ name: 'altitude',
+ required: this.options.slope,
+ meta: 'z',
+ unit: altitude.label,
+ statsName: 'elevation',
+ deltaMax: this.options.altitudeDeltaMax,
+ clampRange: this.options.altitudeRange,
+ // init: ({point}) => {
+ // // "alt" property is generated inside "leaflet"
+ // if ("alt" in point) point.meta.ele = point.alt;
+ // },
+ pointToAttr: (point, i) => {
+ if ("alt" in point) point.meta.ele = point.alt; // "alt" property is generated inside "leaflet"
+ return this._data[i].z *= opts.altitudeFactor;
+ },
+ stats: { max: _.iMax, min: _.iMin, avg: _.iAvg },
+ grid: {
+ axis : "y",
+ position : "left",
+ scale : "y" // this._chart._y,
+ },
+ scale: {
+ axis : "y",
+ position: "left",
+ scale : "y", // this._chart._y,
+ labelX : -3,
+ labelY : -8,
+ },
+ path: {
+ label : 'Altitude',
+ scaleX : 'distance',
+ scaleY : 'altitude',
+ className : 'area',
+ color : color.area || theme,
+ strokeColor : opts.detached ? color.stroke : '#000',
+ strokeOpacity: "1",
+ fillOpacity : opts.detached ? (color.alpha || '0.8') : 1,
+ preferCanvas : opts.preferCanvas,
+ },
+ tooltip: {
+ name: 'y',
+ chart: (item) => L._("y: ") + _.round(item[opts.yAttr], opts.decimalsY) + " " + altitude.label,
+ marker: (item) => _.round(item[opts.yAttr], opts.decimalsY) + " " + altitude.label,
+ order: 10,
+ },
+ summary: {
+ "minele" : {
+ label: "Min Elevation: ",
+ value: (track, unit) => (track.elevation_min || 0).toFixed(2) + ' ' + unit,
+ order: 30,
+ },
+ "maxele" : {
+ label: "Max Elevation: ",
+ value: (track, unit) => (track.elevation_max || 0).toFixed(2) + ' ' + unit,
+ order: 31,
+ },
+ "avgele" : {
+ label: "Avg Elevation: ",
+ value: (track, unit) => (track.elevation_avg || 0).toFixed(2) + ' ' + unit,
+ order: 32,
+ },
+ }
+ };
+}