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
+2 -2
View File
@@ -280,7 +280,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
dawarichEnabled={dawarichEnabled} dawarichTrail={dawarichTrail} dawarichHiddenDates={dawarichHiddenDates} dawarichTrailShown={dawarichTrailShown} toggleDawarichTrail={toggleDawarichTrail}
mobileSidebarOpen={mobileSidebarOpen} showPlaceForm={showPlaceForm} showMembersModal={showMembersModal} showReservationModal={showReservationModal}
poi={poi} tourMap={tourMap} leftPanelPx={leftPanelPx} rightPanelPx={rightPanelPx} mapInsetLeft={mapInsetLeft} mapInsetRight={mapInsetRight}
glMap={glMap} setGlMap={setGlMap} poiPillEnabled={poiPillEnabled} mapPois={mapPois} distanceUnit={distanceUnit}
glMap={glMap} setGlMap={setGlMap} poiPillEnabled={poiPillEnabled} mapPois={mapPois} distanceUnit={distanceUnit} inspectorHeight={pageState.inspectorCard.height}
/>
<div className="hidden md:block" style={{ position: 'absolute', left: 10, top: 10, bottom: 10, zIndex: 20 }}>
@@ -547,7 +547,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {
onDelete={() => handleDeletePlace(selectedPlace.id)}
leftWidth={isMobile ? 0 : leftPanelPx}
rightWidth={isMobile ? 0 : rightPanelPx}
clearMapPill
clearMapPill cardRef={pageState.inspectorCard.measure}
/>
)}
@@ -47,6 +47,8 @@ interface StagePageLocals {
poiPillEnabled: boolean
mapPois: Poi[]
distanceUnit: Settings['distance_unit']
/** The open place card's measured height, so the selected pin is panned above it. */
inspectorHeight?: number
}
export interface PlanMapStageProps
@@ -73,7 +75,7 @@ export function PlanMapStage({
dawarichEnabled, dawarichTrail, dawarichHiddenDates, dawarichTrailShown, toggleDawarichTrail,
mobileSidebarOpen, showPlaceForm, showMembersModal, showReservationModal,
poi, tourMap, leftPanelPx, rightPanelPx, mapInsetLeft, mapInsetRight,
glMap, setGlMap, poiPillEnabled, mapPois, distanceUnit,
glMap, setGlMap, poiPillEnabled, mapPois, distanceUnit, inspectorHeight = 0,
}: Readonly<PlanMapStageProps>): ReactElement {
// ACT-02: a tour compared with its actual track lays the track into the day's lines, dotted.
const compared = useActivityCompareMap({
@@ -115,6 +117,7 @@ export function PlanMapStage({
leftWidth={leftPanelPx}
rightWidth={rightPanelPx}
hasInspector={!!selectedPlace}
inspectorHeight={selectedPlace ? inspectorHeight : 0}
hasDayDetail={!!showDayDetail && !selectedPlace}
reservations={reservations}
showReservationStats={true}
@@ -8,6 +8,7 @@ import { useTrackPortageParts } from '../../components/Tours/paddle/useTrackPort
import { usePaddleObstacleSync } from '../../components/Tours/paddle/usePaddleObstacleSync'
import { tourPlannedTimes as projectTourPlannedTimes } from '../../components/Tours/tourPresentation'
import { usePlanMapViewport } from '../../hooks/usePlanMapViewport'
import { useMeasuredHeight } from '../../hooks/useReportedHeight'
import { usePaddleObstacleStore } from '../../store/paddleObstacleStore'
import { useHighlightedRoute } from '../../components/Tours/bike/useHighlightedRoute'
import { useLegVariantLines } from '../../components/Tours/planner/legVariantPaint'
@@ -101,6 +102,8 @@ export function useTripPlannerPage() {
}, [activeTab, closeGpxTour])
const poi = usePoiExplore()
// The place card's height over the desktop map, so the selection pans its pin above it (#2991).
const inspectorCard = useMeasuredHeight()
const poiViewportChangeRef = useRef(poi.onViewportChange)
poiViewportChangeRef.current = poi.onViewportChange
// The place search looks where the plan map looks, and only while it is on screen.
@@ -163,5 +166,6 @@ export function useTripPlannerPage() {
// The day plan's tours: which places are tours, their planned times and where their stages run (MDT-02).
dayPlanTours: { tourPlaceIds: planner.tourPlaceIds, plannedTourDurations, tourStageStops: planner.tourStageStops },
placeForm: { close: closePlaceForm, ...placeFormContext(planner.editingPlace, planner.assignments, tours) },
inspectorCard,
}
}