fix(map): keep the selected place findable on the map

Selecting a place no longer spiderfies a city-sized cluster: the reveal
only fans open bubbles of up to 12 stops, or stacks whose stops all share
one coordinate, so a zoomed-out trip with hundreds of places stays usable
(#2990).

The selected pin now carries a white border inside a pulsing blue ring on
both renderers (static under reduced motion), and the map measures the
place card instead of assuming a fixed 320px, so the selection pans the
pin above even a tall card on portrait tablets and eases it back out when
the card grows over it later (#2991).

Closes #2990
Closes #2991
This commit is contained in:
Maurice
2026-11-06 11:51:16 +01:00
parent d7c4324afc
commit 4c0583845a
26 changed files with 713 additions and 107 deletions
+23
View File
@@ -1,3 +1,5 @@
import './selectedMarker.css'
/**
* Two ways a place marker can be told apart from the rest, set on the place object the
* planner hands to the map. Underscored because they are the map's reading of the plan,
@@ -39,3 +41,24 @@ export function placeMarkerLook(place: PlaceMarkerFlags, selected: boolean): Pla
key: `${compact ? 'c' : ''}${pending ? 'p' : ''}`,
}
}
/**
* How the selected place stands out from every other pin, the same on both renderers.
*
* Map paint rather than theme: it sits on tiles that are light, dark or a photo, beside
* pins whose border is their category colour. The old near-black border and grey halo
* vanished on dark tiles (#2991); a white border inside a saturated blue ring reads on
* all of them, and the class adds a slow pulse (selectedMarker.css) that stops under reduced motion.
*/
export const SELECTED_MARKER = {
border: '#ffffff', // theme-lint-disable: map paint, has to read on any tile
ring: '0 0 0 3px #0a84ff, 0 4px 14px rgba(0,0,0,0.35)',
className: 'trek-marker-selected',
} as const
/** The border colour and shadow of a round place marker, selected or not. */
export function placeMarkerFrame(selected: boolean, categoryBorder: string): { borderColor: string; shadow: string; className: string } {
return selected
? { borderColor: SELECTED_MARKER.border, shadow: SELECTED_MARKER.ring, className: SELECTED_MARKER.className }
: { borderColor: categoryBorder, shadow: '0 2px 8px rgba(0,0,0,0.22)', className: '' }
}