diff --git a/src/layers/transit/lifecycle.test.mjs b/src/layers/transit/lifecycle.test.mjs index 0a3145e5c..7b300f740 100644 --- a/src/layers/transit/lifecycle.test.mjs +++ b/src/layers/transit/lifecycle.test.mjs @@ -4377,7 +4377,8 @@ test('parked transit reprojects held and reported courses at the bounded camera // A vehicle coming into view is turned on the next pass, the camera still. state._visible.delete(held); held.marker.rotation = 0.7; - held.rotationCourse = undefined; + // Its course as last turned: the camera moved while it was out of view. + held.rotationCourse = held.courseDeg; Object.assign(state, { _visibilityAt: 0, _stillIcons: { upsert: noop, remove: noop }, diff --git a/src/layers/transit/rendering.js b/src/layers/transit/rendering.js index c13018862..4fe02b0dc 100644 --- a/src/layers/transit/rendering.js +++ b/src/layers/transit/rendering.js @@ -944,6 +944,9 @@ export function createRendering({ state, services, parts }) { const wasVisible = state._visible.has(entry); if (visible) state._visible.add(entry); else state._visible.delete(entry); + // Turned afresh once back in view: the camera may have moved while it + // was out, after the pass that would have turned it. + if (visible && !wasVisible) entry.rotationCourse = undefined; if (visible && entry.track?.count) { if (!wasVisible && !entry.qaFixture) syncPlayback(entry, now); // Re-entry can advance into an unprepared corridor; loaded tiles can