Skip to content

Commit 0f9bfa6

Browse files
bmanderclaude
andauthored
Keep stop-focus color when a vehicle is selected (#1893 regression) (#1899)
#1893 routed every vehicle selection through publishMapPresentation(), whose new selected-trip branch always drew the exact trip in the route's GTFS color (currentRouteColor()) over a generic direction underlay. Inside stop focus, where the emphasized route is drawn in its adjacency color, tapping a vehicle therefore reverted the route to its GTFS hue and layered the trip over the generic route-direction geometry — reading as standalone route mode. Resolve the selected trip's color from the adjacency palette (routeColors[selected.routeDirection]) when the route is emphasized in stop focus, falling back to the GTFS color only in whole-route mode where no adjacency entry exists. In that emphasized case also drop the generic direction underlay: the adjacency-colored trip already reads on its own, and the underlay is what made it look like route mode. Whole-route standalone selection is unchanged (GTFS trip + underlay). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f5c7df1 commit 0f9bfa6

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

onebusaway-android/src/main/java/org/onebusaway/android/map/RouteMapController.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -598,21 +598,27 @@ class RouteMapController(
598598
focusedGeometry.toRouteBadges(focusedRoutes, routeColors)
599599
} else emptyList()
600600
val selected = selectedTripPresentation()
601+
// A route emphasized inside stop focus carries an adjacency color (keyed on the focused stop's
602+
// trips); the selected trip keeps that color so selecting a vehicle doesn't drop the route back
603+
// to its GTFS hue. In whole-route mode there is no adjacency entry, so fall back to GTFS.
604+
val selectedAdjacencyColor = selected?.let { routeColors[it.routeDirection] }
601605
val selectedTrip = selected?.points
602606
?.takeIf { it.size >= 2 }
603607
?.let { points ->
604-
focusedRoutePolyline(currentRouteColor(), points, directional = true)
608+
focusedRoutePolyline(selectedAdjacencyColor ?: currentRouteColor(), points, directional = true)
605609
}
606-
// A selected vehicle shows its exact trip everywhere: the trip line over its thin
607-
// same-direction underlay (with any focused-stop siblings beneath), framed to that trip,
608-
// and only its scheduled stops. In whole-route mode the empty [focusedGeometry] collapses
609-
// toTripFocusedRoutePolylines to just the underlay + trip.
610+
// A selected vehicle shows its exact trip everywhere: the trip line, framed to that trip, over
611+
// its scheduled stops. In whole-route mode it sits on a thin same-direction underlay; inside
612+
// stop focus the emphasized route already reads via its adjacency color, so the generic
613+
// direction underlay is dropped (it would otherwise look like standalone route mode) and only
614+
// the focused-stop siblings remain beneath the exact trip.
610615
if (selected != null && selectedTrip != null) {
611616
renderState.setRoutePolylines(
612617
polylines = focusedGeometry.toTripFocusedRoutePolylines(
613618
selected.routeDirection,
614619
routeColors,
615-
selectedDirectionUnderlay(selected.routeDirection.directionId),
620+
if (selectedAdjacencyColor != null) emptyList()
621+
else selectedDirectionUnderlay(selected.routeDirection.directionId),
616622
selectedTrip,
617623
),
618624
framingPolylines = listOf(selectedTrip),

0 commit comments

Comments
 (0)