batch 4: colour by surface/way/SAC, loop accept via edit queue, picker fix #74

Merged
maximus merged 6 commits from batch/2026-11-05-4 into deploy 2026-11-05 21:52:17 +00:00
Member

Batch 4 on top of deploy 5577c715 (live).

  • #49 last item: colour the track line and elevation profile by surface / way type / SAC (editor colour menu + new "Colour route by" chips on the trail view). Data: saved trails from the #62 surface endpoint, new BRouter routes from their way tags; gaps grey; categorical legend.
  • Loop generator: accepting a loop goes through the #68 edit queue as one undo step (no more history wipe); vias snapped onto the candidate's own route (a 10.2 km candidate no longer becomes 36.9 km on accept).
  • Category picker: the fixed dropdown no longer closes on a late scroll event right after opening (real bug, found by the live e2e); unit-tested placement helper.
  • e2e: closeRouteTools() before map clicks (round-3 layout).

Local: svelte-check 0 errors; vitest 1267 passed / 13 skipped. Full e2e against a local build of this branch + live API: 13/13. Live (batch 3): 12/13, the 13th is the picker bug fixed here.

Refs #49, #73.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP

Batch 4 on top of `deploy` 5577c715 (live). - **#49 last item:** colour the track line and elevation profile by **surface / way type / SAC** (editor colour menu + new "Colour route by" chips on the trail view). Data: saved trails from the #62 surface endpoint, new BRouter routes from their way tags; gaps grey; categorical legend. - **Loop generator:** accepting a loop goes through the #68 edit queue as one undo step (no more history wipe); vias snapped onto the candidate's own route (a 10.2 km candidate no longer becomes 36.9 km on accept). - **Category picker:** the fixed dropdown no longer closes on a late scroll event right after opening (real bug, found by the live e2e); unit-tested placement helper. - **e2e:** `closeRouteTools()` before map clicks (round-3 layout). Local: svelte-check 0 errors; vitest 1267 passed / 13 skipped. Full e2e against a local build of this branch + live API: 13/13. Live (batch 3): 12/13, the 13th is the picker bug fixed here. Refs #49, #73. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
The loop generator's accept cleared the anchors, the route and the whole
undo history, then inserted the loop leg by leg outside the serialised
edit queue, so it could interleave with a leg still routing and left one
undo entry per leg.

replaceRouteThroughAnchors (valhalla_store) routes all legs first, then
replaces anchors and route as ONE undo entry inside enqueueRouteEdit:
it waits for edits in flight, clicks made meanwhile wait for it, undo
brings back the replaced route and anchors, and earlier history stays.
A failing leg changes nothing. The editor creates the loop's anchors
up front (createAnchor, split out of addAnchor) and swaps the map
markers in onApplied.

Tests drive it through a mock router (valhalla_loop_accept.test.ts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three categorical metrics join the track-metric registry: surface, way
type and SAC scale. They colour the track line and the elevation-profile
curves in the editor (colour menu) and the trail view (new "Colour route
by" chips under the map), with the trail view's breakdown colours and
labels from trail_surface_view as the one source of truth. Gaps
(unknown / unmatched) render neutral grey.

Data (track_way_types.ts), as per-kind stretches in metres mapped onto
the track points:
- saved trails: the map-matched breakdown (trail_surface_get), in the
  editor only while the route is still the one that was loaded;
- routes drawn with BRouter: the way tags cached per leg in
  route_way_tags, now with the runs of identical tags (direction-aware),
  folded into the backend's vocabulary; legs routed otherwise are unknown;
- otherwise the metric is disabled with "No surface data for this route."

The legend handles categorical colourings (translated labels, vocabulary
order, unknown last); value ranges still read highest first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Accepting re-routes the loop leg by leg between its anchors. The vias are
circle seeds and can lie far off any way: BRouter's multi-via request
matches them to the network, but a 2-point leg to the raw via takes a
very different path (live: a 10.2 km candidate became 36.9 km). The
anchors now sit on the candidate's geometry (loopAnchorPoints: nearest
point after the previous via's, keeping the visiting order), so the
legs reproduce the candidate (10.0 km for the same loop).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valhallaStore.route is mutated in place, so the editor's way segments
now follow the drawn track (mapTrail) instead; without this a route drawn
with BRouter kept "no surface data". The trail view's active "Colour
route by" chip uses the editor's violet accent (bg-primary was barely
visible in dark mode).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since the stacked toolbar layout the route tools panel opens over the
map, so after setEngine / setActivity the planner's map clicks landed on
its controls ("Trail technicality"). closeRouteTools() closes it again
in both subcategory-suggestion specs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(category-picker): keep the fixed dropdown open while its container scrolls
All checks were successful
CI / web (push) Successful in 1m46s
CI / go (push) Successful in 14m25s
c48b528d53
The fixed dropdown (trail editor form) closed on every scroll event. A
scroll is reported a frame late, so scrolling the picker into view and
clicking it (Playwright's click, a quick wheel-then-click, momentum
scrolling, a layout shift from the pace panel) opened the list and closed
it again at once: the live e2e "Trail or Alpine" spec timed out on the
missing "Hiking" item with the picker focused and no list open.

It now follows the button on scroll (fixedDropdownPlacement in
$lib/util/fixed_dropdown, unit-tested) and closes only once the button
has left the scrolled container or the viewport.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
maximus merged commit c48b528d53 into deploy 2026-11-05 21:52:17 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/wanderer!74
No description provided.