fix(rail, transit): a train or vehicle a first-person view holds draws no 3D model either, since the view's eye is inside it; let go, its model draws again

The fleet models (#1714) draw nearby trains and vehicles under the 3D toggle. A
held one now leaves out its model as it does its icon, as the Vessels layer does
for its bridge subject: its model item is hidden, and handing the visual back
to its icon keeps the icon hidden while held. Tests drive each layer with the
real fleet-model layer and a stubbed glTF loader; both fail without the fix.
This commit is contained in:
Denis Groshev committed 2026-11-13 16:43:50 +01:00
1 parent 546ac22708
commit 974023510f
12 files changed
+212 -17

No files matched your search

+9 -3
View File
@@ -493,7 +493,7 @@ export function createRendering({ state, services, parts }) {
});
}
/** Hand an entry's visual back to its icon. */
/** Hand an entry's visual back to its icon, unless a view rides it. */
function handBack(entry) {
if (!entry.modelOwnsVisual) return;
entry.modelOwnsVisual = false;
@@ -501,7 +501,8 @@ export function createRendering({ state, services, parts }) {
entry.marker.show =
vehicleInView(entry) &&
!entry.heightPending &&
entry.surfaceReady !== false;
entry.surfaceReady !== false &&
entry.key !== state._cockpitSubjectKey;
}
function updateModels() {
@@ -538,7 +539,12 @@ export function createRendering({ state, services, parts }) {
}
item.position = entry.marker.position;
item.headingDeg = Number.isFinite(entry.courseDeg) ? entry.courseDeg : 0;
item.show = !entry.heightPending && entry.surfaceReady !== false;
// A vehicle a first-person view rides draws no model: the camera is
// inside it (cockpitSubject.js).
item.show =
!entry.heightPending &&
entry.surfaceReady !== false &&
entry.key !== state._cockpitSubjectKey;
next.set(entry.key, item);
}
for (const [key, item] of modelItems)