Skip to content

Commit edd3667

Browse files
committed
Show LRR course profile in leg calculator
1 parent a38c0c4 commit edd3667

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

js/LegCalculator.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ export class LegCalculator extends HTMLElement {
102102
let legDesc = `<div class="d-flex flex-column flex-lg-row justify-content-between align-items-baseline"><h5>${legName}</h5><h6>${distance.toFixed(2)}mi ↑${ascent.toFixed(0)}ft ↓${descent.toFixed(0)}ft</h6></div>`
103103
container.querySelector("#leg-calculator-description").innerHTML = legDesc
104104
});
105+
106+
let profile = container.querySelector("elevation-profile")
107+
if (profile) {
108+
let allLegElevationData = legs.flatMap((leg) => leg.geometry.coordinates)
109+
profile.elevationData = allLegElevationData
110+
}
105111
}
106112
connectedCallback() {
107113

pages/light-rail-relay-24.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@
368368
border: 1px solid #111;
369369
}
370370

371+
#leg-calculator elevation-profile path {
372+
fill: #333
373+
}
374+
371375
.noUi-connect {
372376
background-color: var(--theme-primary-color);
373377
}
@@ -481,16 +485,16 @@ <h2 id="route">Route <a href="#route" class="anchor-link" aria-label="Link to th
481485
<a href="#" class="btn btn-outline-primary mb-3 m-sm-0 " id="download-route-gpx-btn" hidden>Download Route GPX</a>
482486
</div>
483487

484-
<h5>22 legs - 38 mi ↑3000ft ↓3000ft</h5>
485-
<p>The relay will start at Angle Lake station and follow the 1 Line to Lynnwood, visiting every station on the way. The route passes through a total of 6 cities.</p>
486-
488+
<h5>22 legs - 38 mi ↑3800ft ↓3800ft</h5>
489+
<p>The relay will start at Angle Lake station and follow the 1 Line to Lynnwood, visiting every station on the way. The route passes through 6 cities across 2 counties.</p>
487490

488491
<leg-calculator id="leg-calculator" class="mb-3 p-2 p-lg-4" style="display: none">
489492
<h6 class="text-secondary">Segment Calculator</h6>
490493
<div id="leg-calculator-description"></div>
491494
<div class="mx-3">
492495
<div class="leg-range-input mt-5 mb-5" id="leg-calculator-slider"></div>
493496
</div>
497+
<elevation-profile class="mx-3"></elevation-profile>
494498
</leg-calculator>
495499

496500

0 commit comments

Comments
 (0)