Reset a train's turn point on a new playback epoch

- A clock correction starts a new epoch, and playback may first draw its
  second report. The turn point now resets on a new epoch as well as on a
  break, so a standing train no longer turns around after a correction.
- recallDirection and earlierFixes are gone: comparing each earlier report
  with the newest turned a standing train on GPS jitter. A train bound when
  its line arrives late shows no direction until it has moved 15 m.
- Tests share reportDirections, iconOf and the playback helper.
- Comments and CURRENT-STATE match the code.
This commit is contained in:
German Khokhlov committed 2026-11-19 00:26:57 +04:00
1 parent 58afb169d1
commit e8ef4d1293
8 files changed
+108 -131

No files matched your search

+10 -11
View File
@@ -2770,9 +2770,9 @@ The Rail layer offers a read API for such a view: `getSelectedTrain()` and
`getCockpitSubject()` (a snapshot of the train: where it is along its line,
which way it runs (`pathBinding.js` learns it), its rail height (null while
no floor is known), speed as reported or derived, position source, feed
credit and stops, and
`selectedAtMs`, when the user last selected it by a click or `focusTrain`,
even again; null after a deselection and for a train only a hold selected),
credit and stops, and `selectedAtMs`, when the user last selected it by a
click or `focusTrain`, even again; null after a deselection and for a train
only a hold selected),
`setCockpitSubject(key)` (its marker, 3D model and card hidden, the selection kept, its
feed held, clicks and Escape left to the view; the held copy stays the one
drawn of its train while held, another feed's copy hidden, and it keeps
@@ -2790,14 +2790,13 @@ view. Turning the layer off ends the hold. Its snapshot's
marker's height while it is placed, else its segment's two reports' floors at
the playback fraction), not the newest report's, and null while either of
those two floors is unknown. Rail's `path.direction` is the way the drawn
train runs: once playback has placed it, a report that runs back turns it
only when playback starts the segment to that report. A train turns once it
is more than a standing train's GPS jitter back from the last place a longer
move took it, however slowly it backs, so jitter on either side of where it
stands keeps its direction, and so does a jump to a corrected position.
A train bound after it stopped takes its direction from earlier reports in
the same run. While movement gives no direction, the snapshot uses the
operator's last reported bearing.
train runs: once playback has told its direction, a report that runs back
turns it only when playback starts the segment to that report. A train turns
once it is more than a standing train's GPS jitter back from the last place a
longer move took it, however slowly it backs, so jitter on either side of
where it stands keeps its direction, and so does playback's jump to a
corrected position (a break, or a new clock epoch). While movement gives no
direction, the snapshot uses the operator's last reported bearing.
`docs/APPLICATION.md` (Cockpit subjects) shows a minimal provider.
`src/ui/cockpitSubjectView.test.mjs`, `src/cockpitSubjectProviders.test.mjs`,
`src/cockpitProgress.test.mjs`, `src/layers/rail/cockpitSubject.test.mjs`,