Skip to content

Releases: Kntnt/kntnt-gpx-blocks

v0.14.1

Choose a tag to compare

@TBarregren TBarregren released this 14 May 21:31

Fixes

  • #153 Map's track cursor doesn't render in block editor preview (0ff1a4d)

Maintenance

  • #151 Reduce InspectorBottomSpacer default height from 400px to 135px (154e032)
  • #152 Remove "Get one" external link from tile-key API notice in Map inspector (07ed47f)

v0.14.0

Choose a tag to compare

@TBarregren TBarregren released this 14 May 20:10

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

  • #83 Add InspectorBottomSpacer so Appearance dropdown isn't squashed at inspector bottom (c7bb539)

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

Choose a tag to compare

@TBarregren TBarregren released this 14 May 17:37

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 existing typography prop drives tick-label remeasurement. The frontend was unaffected — it already re-measures every frame.

v0.13.7-pl.2

Choose a tag to compare

@TBarregren TBarregren released this 14 May 17:23

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 assumed bbox.height equalled the distance from glyph top to baseline. Each tooltip row is now positioned by its visual bbox top, so the 0.5em padding above and below the visible glyphs is symmetric regardless of glyph composition.

Internal

  • New pure helper computeTooltipLayout in geometry/tooltip-layout.ts. Both view.ts (frontend) and chart.tsx (editor preview) now call it, replacing the previously duplicated layout formulas.
  • TextMeasurement carries a new topOffset field (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

Choose a tag to compare

@TBarregren TBarregren released this 14 May 16:09

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 group on CursorElements.
  • Re-append both the cursor and tooltip groups after every drawChart so they always sit at the end of the children list. SVG paints in document order — later elements appear on top.

v0.13.7

Choose a tag to compare

@TBarregren TBarregren released this 14 May 15:55

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 y is constant at plotRect.y + 0.5em; only x changes 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.NumberFormat with the site locale handles separators and grouping.
  • Per-row visibility toggles. tooltipShowDistance and tooltipShowHeight independently 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, fraction only. The two new row toggles travel via data-wp-context per block.
  • Nine new colour + typography surfaces. tooltipBackgroundColor, tooltipDistanceColor, tooltipHeightColor plus eight typography attributes per row × two rows. Server-side wired through Color_Sanitizer / Typography_Sanitizer; SCSS defaults fall back to #000000cc / #ffffff / #dddddd / inherit.

Cleanups

  • geometry/cursor.ts split into geometry/sample-interpolation.ts; the SVG DOM helpers in root-level cursor.ts stay.
  • createTextMeasurer( svg, className? ) gains an optional class parameter so tooltip-row measurements pick up their class-scoped typography.

v0.13.6-pl.1

Choose a tag to compare

@TBarregren TBarregren released this 14 May 11:03

Features

  • #143 Hide inert dependent Inspector controls when their master toggle is off (44ca3dc)
  • #144 Elevation: Cursor & guides controls (86ed489)

v0.13.6

Choose a tag to compare

@TBarregren TBarregren released this 14 May 09:41

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 setPointerCapture so 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 pointerleave on 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-cursor is wired through the inspector's Cursor colour row; the SCSS default #d63638 matches 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 passing
  • vendor/bin/phpstan — no errors
  • npm run test:js — 459 / 459 passing
  • npx wp-scripts lint-js src/blocks/ — clean

v0.13.5-pl.11

Choose a tag to compare

@TBarregren TBarregren released this 14 May 07:48

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

Choose a tag to compare

@TBarregren TBarregren released this 14 May 07:40

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.