From 37d44c3364ac66d52b8a3c2ee3b30776ded4f9cd Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Wed, 11 Nov 2026 08:16:27 -0800 Subject: [PATCH] A transit vehicle coming into view is turned along its course at once The rotation pass reprojected courses only when the camera moved, a poll marked a course, or a vehicle was moving. A vehicle that entered the view or was shown on a later visibility sweep (its ground height arriving after its poll) kept the icon pointing up until one of those happened, under a camera that held still. The visibility sweep now marks the rotations for the next pass when it changes what is in view or shown. --- src/layers/transit/lifecycle.test.mjs | 15 +++++++++++++++ src/layers/transit/rendering.js | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/layers/transit/lifecycle.test.mjs b/src/layers/transit/lifecycle.test.mjs index 22e191932..0a3145e5c 100644 --- a/src/layers/transit/lifecycle.test.mjs +++ b/src/layers/transit/lifecycle.test.mjs @@ -4373,6 +4373,21 @@ test('parked transit reprojects held and reported courses at the bounded camera 0, 'selected unknown course also stays screen-up', ); + state._selectedKey = null; + // 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; + Object.assign(state, { + _visibilityAt: 0, + _stillIcons: { upsert: noop, remove: noop }, + _movingIcons: { upsert: noop, remove: noop }, + }); + rendering.refreshVisibility(); + assert.ok(state._visible.has(held), 'back in view'); + t.mock.timers.tick(200); + rendering.onPreRender(); + assert.notEqual(held.marker.rotation, 0.7, 'turned once in view'); }); test('a view with no feed reads its coverage prompt, not an undated feed', async (t) => { diff --git a/src/layers/transit/rendering.js b/src/layers/transit/rendering.js index 6fadcc187..c13018862 100644 --- a/src/layers/transit/rendering.js +++ b/src/layers/transit/rendering.js @@ -970,7 +970,12 @@ export function createRendering({ state, services, parts }) { } flushMarkers(); state._shownCount = state._visible.size; - if (changed) state._detectRevision++; + if (changed) { + state._detectRevision++; + // A vehicle that came into view or was shown is turned on the next + // rotation pass, though neither the camera nor a poll changed. + state._rotationDirty = true; + } syncRenderHold(); governorRequestRender('transit-visibility'); return state._shownCount;