fix(rail): a held train stays the copy drawn of its train and keeps moving, hidden, when its category is turned off

The duplicate filter hid a held copy when another feed's copy outranked it
and moved the selection away, so the held train stopped playing and the
other copy's marker and card came back over the view. A copy a first-person
view holds is now drawn whatever the scores until the view lets go; the
better copy takes over at the next poll after the release. Holding a copy
that another feed drew draws it at once.

A category toggle no longer deselects a held train, and a held train keeps
playing, its marker hidden, while its category is off. Released, it is
deselected and stops as the toggle leaves any other train.
This commit is contained in:
Denis Groshev committed 2026-11-12 17:00:12 +01:00
1 parent fe7590d66a
commit 4ae67fcb35
6 files changed
+215 -16

No files matched your search

+10 -2
View File
@@ -516,6 +516,14 @@ export function createRendering({ state, services, parts }) {
return categoryShown(entry) && entry.key !== state._cockpitSubjectKey;
}
/**
* Whether the train's playback runs: it is drawn, or a first-person view
* rides it, which keeps it moving, hidden, in a category turned off.
*/
function playing(entry) {
return categoryShown(entry) || entry.key === state._cockpitSubjectKey;
}
/**
* A train bound to its railway line is drawn on the line, at the arc its
* playback has reached; any other train (or a bound train whose reports do
@@ -602,7 +610,7 @@ export function createRendering({ state, services, parts }) {
place(entry);
const sample = entry.sample;
const moving =
categoryShown(entry) &&
playing(entry) &&
sample?.phase === 'playing' &&
sample.segmentSpeedMps > 0;
if (moving) {
@@ -610,7 +618,7 @@ export function createRendering({ state, services, parts }) {
return;
}
state._moving.delete(entry);
if (categoryShown(entry) && Number.isFinite(sample?.nextWakeMonoMs)) {
if (playing(entry) && Number.isFinite(sample?.nextWakeMonoMs)) {
entry.wakeTimer = setTimeout(
() => {
entry.wakeTimer = null;