From db37617fa642614af83b8bfc7ef81af0018927d1 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Wed, 11 Nov 2026 08:38:58 -0800 Subject: [PATCH] A transit vehicle back in view is turned for the camera as it is now Its last turn was kept when it came back into view, so a vehicle that left the view while the camera moved, and came back after the pass for the camera's new pose, kept the turn from the old pose until the camera moved again. Coming back into view now clears its last turn. --- src/layers/transit/lifecycle.test.mjs | 3 ++- src/layers/transit/rendering.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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