diff options
| author | Dennis Fink | 2026-07-23 00:18:21 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-07-23 00:18:21 +0200 |
| commit | 1fe1d13c600b7dfe421b3b99b833b7d5d1232724 (patch) | |
| tree | 2e8636160cc1719c907be56f5ef8cbc7e0f10a53 /assets/static/vendor/leaflet-elevation/src/handlers/heart.js | |
| parent | ca77de06be474dfd712402c327dc436864d233a3 (diff) | |
| download | dennisfink.me-1fe1d13c600b7dfe421b3b99b833b7d5d1232724.tar.gz dennisfink.me-1fe1d13c600b7dfe421b3b99b833b7d5d1232724.zip | |
Add GPX trail maps to blog posts
This adds a trail flow block so posts can include attached GPX files as
interactive maps with route display, elevation charts, activity
summaries, and start/finish markers.
The trail assets are loaded only when needed, keeping the shared
templates clean while vendoring the Leaflet dependencies required for
offline, self-hosted map rendering.
Diffstat (limited to 'assets/static/vendor/leaflet-elevation/src/handlers/heart.js')
| -rw-r--r-- | assets/static/vendor/leaflet-elevation/src/handlers/heart.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/assets/static/vendor/leaflet-elevation/src/handlers/heart.js b/assets/static/vendor/leaflet-elevation/src/handlers/heart.js new file mode 100644 index 0000000..1930f60 --- /dev/null +++ b/assets/static/vendor/leaflet-elevation/src/handlers/heart.js @@ -0,0 +1,53 @@ +export function Heart() {
+
+ const _ = L.Control.Elevation.Utils;
+
+ return {
+ name: 'heart', // <-- Your custom option name (eg. "heart: true")
+ unit: 'bpm',
+ meta: 'hr', // <-- point.meta.hr
+ coordinateProperties: ["heart", "heartRates", "heartRate"], // List of GPX Extensions ("coordinateProperties") to be handled by "@tmcw/toGeoJSON"
+ pointToAttr: (point, i) => (point.hr ?? point.meta.hr ?? point.prev('heart')) || 0,
+ stats: { max: _.iMax, min: _.iMin, avg: _.iAvg },
+ scale: {
+ axis : "y",
+ position : "left",
+ scale : { min: -1, max: +1 },
+ tickPadding: 25,
+ labelX : -30,
+ labelY : -8,
+ },
+ path: {
+ label : 'ECG',
+ yAttr : 'heart',
+ scaleX : 'distance',
+ scaleY : 'heart',
+ color : 'white',
+ strokeColor : 'red',
+ strokeOpacity: "0.85",
+ fillOpacity : "0.1",
+ },
+ tooltip: {
+ chart: (item) => L._("hr: ") + item.heart + " " + 'bpm',
+ marker: (item) => Math.round(item.heart) + " " + 'bpm',
+ order: 1
+ },
+ summary: {
+ "minbpm": {
+ label: "Min BPM: ",
+ value: (track, unit) => Math.round(track.heart_min || 0) + ' ' + unit,
+ // order: 30
+ },
+ "maxbpm": {
+ label: "Max BPM: ",
+ value: (track, unit) => Math.round(track.heart_max || 0) + ' ' + unit,
+ // order: 30
+ },
+ "avgbpm": {
+ label: "Avg BPM: ",
+ value: (track, unit) => Math.round(track.heart_avg || 0) + ' ' + unit,
+ // order: 20
+ },
+ }
+ };
+};
\ No newline at end of file |
