Skip to content

Stop+route focus: data poll reframes the camera to the whole route #1895

Description

@bmander

Summary

In stop + route focus mode, when a background data poll updates route info, the
map camera reframes to fit the whole route — discarding the pan/zoom the rider had
set. Periodic data polls should refresh the data (vehicles, stops, geometry) without
issuing a camera framing. The camera should only move in response to explicit user
navigation (opening a route, re-tapping to snap back, focusing a vehicle), never as a
side effect of a poll.

Steps to reproduce

  1. Open a route and focus a stop (stop + route focus, showing the route(s) serving that stop).
  2. Pan/zoom the map somewhere the rider wants to keep (e.g. zoom into the focused stop).
  3. Wait for the next data poll to land.

Expected

The camera stays put. The poll refreshes vehicles/geometry underneath the current
viewport.

Actual

The camera reframes to the whole route's extent, throwing away the rider's view.

Where it comes from

FramingIntent.Route is a retained framing — MapRenderState._framingIntent is a
replay = 1 SharedFlow, and the camera collector re-applies the last framing to the
current geometry:

  • render/MapRenderState.kt_framingIntent (replay = 1); routeFramingPolylines is
    refreshed on every setRoutePolylines(...) call (i.e. every publishMapPresentation()).
  • src/google/.../compose/GoogleComposeAdapter.kt (and the MapLibre equivalent) —
    renderState.framingIntent.filterNotNull().collect { applyFramingIntent(...) }, where
    FramingIntent.Route fits to renderState.routeFramingPolylines read at apply time.
  • map/RouteMapController.kthost.frameRoute() (→ frame(FramingIntent.Route)) plus
    the per-publish framingPolylines updates.

So a retained route framing re-applied after a poll-driven republish (or a collector
re-subscription) fits to the freshly-republished whole-route geometry. Framing is
currently coupled to the data-republish path rather than to explicit navigation intent.

Suggested direction

Decouple camera framing from data polls: a poll that only updates route info/geometry
should update routeFramingPolylines (camera state) without causing the camera to
move. Framing should fire only from explicit navigation actions. Guarding this in
stop + route focus specifically (where the rider has usually zoomed into the focused
stop) is the priority.

Context

Related to the recent framing/route-focus work: #1892 (unified route focus rendering)
and #1893 (focus vehicles on exact trip geometry).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions