Skip to content

v0.13.4

Choose a tag to compare

@TBarregren TBarregren released this 13 May 08:49
· 61 commits to main since this release

Step 4 of the GPX Elevation rebuild: both axes carry tick marks and labels driven by the GPX data range.

What's new

  • X axis runs from 0 to the bound track's distance and switches between metres and kilometres on a deterministic threshold (distance < 2000 m → metres, otherwise km). Ticks are filtered Strava-style so no rendered value exceeds distance. The first tick is always 0.
  • Y axis runs from a rounded-down floor to a rounded-up ceiling of the elevation range and stays in metres. All generated Y ticks render; the lowest sits on the X axis line and the highest sits at y = wTop.
  • Adaptive tick count follows the additive formula floor((avail + 0.5em) / (refSize + 0.5em)), clamped to ≥ 2. Constant 0.5em luft replaces Step 3's proportional × 1.5 — same visual gap whether labels are "0 m" or "1234 m".
  • Margins gain wTop to reserve the upper half of the topmost Y label; wRight is derived from a worst-case reference string keyed on distance, so margins stay stable across resize and the chicken-and-egg between margins and tick count is broken.
  • Axis-label colour is wired end-to-end. The existing axisLabelColor attribute reaches the SVG <text> fills through the new CSS custom property --kntnt-gpx-blocks-elevation-axis-label. The Axis colour continues to drive axis lines and tick marks independently.

Internal

  • format.ts: new xReferenceString(distance, locale); chooseXUnit switched to a distance-only oneliner; formatXLabels gained a distance parameter.
  • ticks.ts: computeTickCount(avail, refSize, em) adopts the additive luft formula.
  • margins.ts: Margins gains wTop; wRight keyed on xReferenceString(distance).
  • chart.tsx / view.ts: render two tick-mark groups and two tick-label groups; redraw on ResizeObserver without recomputing margins; webfont-aware via loadingdone.

See docs/elevation-rebuild.md for the full Step 4 spec.