Commit Graph
3 Commits
Author SHA1 Message Date
Sameh Khamis 0a0c6a0e5b Vessel playback moves icons on the renderer's clock
While the timeline plays or is scrubbed, each vessel icon is handed to the
renderer as a motion segment along its track (a straight piece of at most
10 km between two fixes, on the scene clock), as aircraft already are. The
layer writes an icon again only when its segment runs out or the time
moves back before it, instead of moving every icon on the CPU every frame.

Behaviour is kept:
- Icons follow the same great-circle track between fixes (a 10 km chord
  stays within 2 m of it) with the same course.
- A vessel still appears TIMELINE_UNSEEN_MS before its first fix and
  hides again when the time moves back before that.
- Cards, the selected vessel, ship models and the vessel the bridge camera
  rides are read where they are every frame; the rest within
  HIDDEN_FOLLOW_MS, as before.
- Position reads (getAllPositions, getNearby, the focus pass, the
  detection overlay, single-vessel lookups) return where the icon is drawn
  at the world time.
- Going live, each icon holds where its segment last drew it, unless a
  live update has drawn it since.
- Trails are unchanged: they are built from the feed's fixes, not from the
  per-frame position.
- Live mode and renderers without the motionSegments capability take the
  previous path unchanged.
2026-11-15 23:56:03 -08:00
Sameh Khamis 2b5fb51684 Contacts move back as smoothly as they move on
A snapshot timeline may declare spanMs: each record of a snapshot at a
time then carries its own fixes from spanMs before the time to spanMs
after it. Flights, military flights and vessels following the clock are
placed on those fixes, so a seek or a move back within the fixes loaded
is no jump: nothing is cleared and play does not wait. The step there is
asked for once and stands in for every contact; those it has keep their
place. Fixes are merged across snapshots at least 20 s apart, at most
240 a contact, and a contact is not drawn more than a minute before its
first fix.
2026-11-15 09:27:31 -08:00
Sameh Khamis 57ff81f723 feat(live): flights, military and vessels follow the world clock when their source declares a timeline
A live source may now declare a timeline: it can answer a snapshot at a
given time (source.timeline = { coverage(), stepMs, subscribe? }, read by
readSnapshotTimeline). While such a layer is on it follows the world clock
and registers the coverage. At the live edge it polls exactly as before;
away from it the layer asks for getSnapshot({ ...query, atMs }) at the step
at or before the clock time and shows that snapshot instead of polling.

src/time/snapshotTimeline.js owns the following: a seek, time going
backwards or leaving live replaces every contact with the snapshot at the
new time (play waits on it, for at most 8 s); playing on keeps one
snapshot ahead and gates play on it, applying those snapshots as polls so
contacts move smoothly; outside coverage the layer is empty; back at live
it is cleared and polls at once. One load at a time, and a load the
source drops for a newer one is not a failure.

While following, aircraft are drawn at the clock time with no render
delay, records and absences are judged at the clock, track requests carry
atMs, and vessels move between fixes along the great circle. The world
clock counts jumps (seeks and returns to live) in getState().

A source with no timeline never follows the clock, and every layer stays
live, unchanged.
2026-11-10 18:12:53 -08:00