Releases: Kntnt/kntnt-gpx-blocks
Release list
v0.14.1
v0.14.0
Features
- #147 Expose mapId in Map's block toolbar as click-to-copy badge (12182c8)
- #149 Centralise base-provider tile API keys end-to-end (d43d6c8)
- #150 Centralise overlay-provider tile API keys end-to-end (bdcdfd1)
Fixes
Maintenance
- #145 Migrate Map's two Typography panels to shared TypographyToolsPanel (e806b7c)
- #146 Simplify Map's wrapper-sizing default (single-mechanism min-height: 30vh) (a4e0926)
- #148 Remove docs/elevation-rebuild.md and clean up all references (b092fc2)
Breaking changes (pre-1.0)
The tileApiKeys and tileOverlayApiKeys block attributes are removed from kntnt-gpx-blocks/map. Per-block API keys are replaced by a site-wide settings page at Settings → Kntnt GPX Blocks, backed by two new options kntnt_gpx_blocks_tile_provider_keys and kntnt_gpx_blocks_tile_overlay_keys. PHP filter precedence is preserved verbatim; see docs/hooks.md for the full contract.
v0.13.7-pl.3
Fixes
- Editor tooltip rect now re-sizes when the per-row Typography font-size changes. Previously the wrapper's CSS custom properties updated correctly — the rendered glyphs adopted the new font-size — but the editor preview's tooltip
<rect>stayed at its first-mount dimensions because the layout effect that sizes the rect did not list any tooltip-row typography field in its dep-list. Two new<Chart>props (tooltipDistanceTypography,tooltipHeightTypography) carry each row's eight typography fields purely to populate that dep-list, mirroring how the existingtypographyprop drives tick-label remeasurement. The frontend was unaffected — it already re-measures every frame.
v0.13.7-pl.2
Fixes
- Single-row tooltip vertical centering. When only one of the tooltip rows (Distance or Height) was visible, digit-only labels (e.g.
10.1 km,79 m) sat too low inside the rect, leaving more whitespace above than below. The cause was Chrome/Safari reporting an SVG<text>bbox that reaches the font's descent extent below the baseline even for glyphs with no descenders, combined with a layout formula that assumedbbox.heightequalled the distance from glyph top to baseline. Each tooltip row is now positioned by its visual bbox top, so the0.5empadding above and below the visible glyphs is symmetric regardless of glyph composition.
Internal
- New pure helper
computeTooltipLayoutingeometry/tooltip-layout.ts. Bothview.ts(frontend) andchart.tsx(editor preview) now call it, replacing the previously duplicated layout formulas. TextMeasurementcarries a newtopOffsetfield (signed offset from the text's baseline to its bbox top) so callers can position SVG<text>by its visual bounds.
v0.13.7-pl.1
Bug fix — keep cursor + tooltip on top after redraws
drawChart removes the per-redraw elements (axes, curve, ticks, labels) and appends fresh ones at the end of the SVG's children list. The cursor and tooltip groups are persistent across redraws, so on every redraw after the first (resize, font load, …) they ended up at the start of the children list and were painted over by the freshly-drawn curve — making the tooltip's numbers unreadable wherever the curve passed through.
Fix
- Expose
grouponCursorElements. - Re-append both the cursor and tooltip groups after every
drawChartso they always sit at the end of the children list. SVG paints in document order — later elements appear on top.
v0.13.7
Step 7 — Tooltip
The Elevation block's cursor now carries a top-pinned tooltip showing the interpolated distance and elevation at the cursor's fraction. The tooltip follows the cursor horizontally and flips to the left side with 0.5em hysteresis when it would otherwise clip the plot rectangle's right edge.
Highlights
- Top-pinned anchor with horizontal-only flip. The tooltip's
yis constant atplotRect.y + 0.5em; onlyxchanges with the cursor. A 0.5em hysteresis band prevents flip oscillation at the threshold. - Locale-aware deterministic formatting. Distance line uses the same m/km threshold as the x-axis ticks (below 2000 m → metres, above → km with 1 decimal); elevation line is always in metres.
Intl.NumberFormatwith the site locale handles separators and grouping. - Per-row visibility toggles.
tooltipShowDistanceandtooltipShowHeightindependently gate each row. When both are off, the tooltip group is not rendered. showCursor-coupled hide-on-master-off. When the Cursor master toggle is off, the tooltip group is not emitted and the entire tooltip inspector surface (Tooltip info PanelBody, three tooltip Color rows, two Tooltip typography PanelBodies) disappears.- Cross-block sync is automatic. Map's cursor scrub writes
state[ mapId ].fraction; the same fraction read drives both Elevation's cursor and its tooltip in lockstep. - No state-payload growth. The per-mapId slice still has
samples,statistics,fractiononly. The two new row toggles travel viadata-wp-contextper block. - Nine new colour + typography surfaces.
tooltipBackgroundColor,tooltipDistanceColor,tooltipHeightColorplus eight typography attributes per row × two rows. Server-side wired throughColor_Sanitizer/Typography_Sanitizer; SCSS defaults fall back to#000000cc/#ffffff/#dddddd/inherit.
Cleanups
geometry/cursor.tssplit intogeometry/sample-interpolation.ts; the SVG DOM helpers in root-levelcursor.tsstay.createTextMeasurer( svg, className? )gains an optional class parameter so tooltip-row measurements pick up their class-scoped typography.
v0.13.6-pl.1
v0.13.6
Step 6 — Cursor with cross-block sync
The Elevation block grows a cursor on the curve plus an L-shape pair of guide lines pointing at the corresponding x and y axis ticks. The cursor on GPX Map and the cursor on GPX Elevation stay synchronised through the shared state[ mapId ].fraction slot — a scrub on either block moves both cursors.
Behaviour
- Mouse hover updates the cursor continuously while the pointer is inside the chart's plot rectangle.
- Mouse press-and-drag uses
setPointerCaptureso the gesture persists when the pointer drifts off the hit-rect; releasing the button leaves the cursor at its final position so the user can read the value. - Mouse
pointerleaveon the wrapper nulls the fraction, hiding the cursor — but the dismissal is suppressed during an active scrub and on touch pointers so finger-lift doesn't make the cursor flicker off. - Touch press-and-drag updates fraction; the cursor persists after finger-lift.
- The cursor's CSS variable
--kntnt-gpx-blocks-elevation-cursoris wired through the inspector's Cursor colour row; the SCSS default#d63638matches Map's track cursor default for visual parity.
Map-side z-order fix (no-touch exception)
Map's track-cursor marker now uses the shared SVG renderer and is added after the waypoint markers in bootMount, so the cursor sits on top of any waypoint it passes over. Pre-fix, the cursor used the default canvas renderer and ended up in a separate <canvas> element under <overlayPane> — SVG paints on top of canvas, so every waypoint visually obscured the cursor whenever the cursor scrubbed through it.
Gates
npm run build✓composer test— 549 / 549 passingvendor/bin/phpstan— no errorsnpm run test:js— 459 / 459 passingnpx wp-scripts lint-js src/blocks/— clean
v0.13.5-pl.11
Add 0.5 rem visible gap between waypoint marker and tooltip.
With the arrow gone (v0.13.5-pl.10), Leaflet's bundled ±6 px margin on .leaflet-tooltip-top / .leaflet-tooltip-bottom matched the marker radius exactly, so the tooltip sat flush with the marker's visible edge and the mouse cursor obscured the first line. Override the margins with calc(±6px ± 0.5rem) and bump the JS flip threshold by the same WAYPOINT_MARKER_RADIUS_PX + 0.5 rem so JS and CSS agree on the rendered position.
v0.13.5-pl.10
Keep waypoint tooltips inside the map container.
The runtime tooltip now picks top or bottom direction per open based on whether the marker has room above for the pre-measured tooltip height, and shifts horizontally so the left and right edges stay 0.5 rem inside the container. The arrow is removed since a horizontally shifted tooltip can no longer point at the marker.
The editor preview's sample tooltip is decoupled from the waypoint's projected position and pinned to the map host's upper-right corner — it is a style preview, not a layout preview, so clipping is solved by construction.