fix(cockpit): application subjects follow a change of language, never stand on the ellipsoid, and are guarded on every call; a re-selected subject takes entry again

- Labels, entry face and look may be functions, read again on every use
  and on a locale change; a failing read keeps the last good value.
- A frame with no height keeps the eye's last height, or waits
  (surfaceAcquiring) until the floor is known; heights outside
  -1,000..50,000 m read as null.
- Provider methods are synchronous: a returned promise is refused like a
  throw, and a hold that fails is released.
- A candidate may carry selectedAt; Rail and Transit stamp selectedAtMs
  on every selection, so re-selecting moves a subject to the front.
- A released Transit vehicle leaves the visible set at once.
- docs/CURRENT-STATE.md states the new entry order; docs/APPLICATION.md
  documents cockpit subjects, ./i18n/locale and ./layers/rail/paths.
This commit is contained in:
Denis Groshev committed 2026-11-12 11:13:58 +01:00
1 parent 01a74fceec
commit 57d87d2bbf
18 files changed
+707 -199

No files matched your search

+7 -2
View File
@@ -14,8 +14,11 @@ import { displayMotion } from '../transit/movement.js';
* selection. The hold ends with `setCockpitSubject(null)`, and on its own
* when the train is removed or the layer is turned off. A train removed while
* held leaves its feed polled until the next `setCockpitSubject` call, so a
* view that waits for it holds it again if the feed lists it again. `focusTrain(key)` selects a train and
* hands it the camera, as a click does.
* view that waits for it holds it again if the feed lists it again.
* `focusTrain(key)` selects a train and hands it the camera, as a click does.
* A snapshot's `selectedAtMs` is when the user last selected the selected
* train, even again (null for any other), for a view's entry to tell a
* re-selection.
*
* @param {object} context The layer's state, parts, services and timetable.
* @returns {{methods: object}}
@@ -98,6 +101,8 @@ export function createRailCockpitSubject({
return Object.freeze({
key: entry.key,
feedId: entry.feedId,
selectedAtMs:
state._selectedKey === entry.key ? state._selectedAtMs : null,
id: String(record.id ?? ''),
tripId: record.tripId || null,
routeId: record.routeId || null,