mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(weather): weather cards measure from the timeline time and know when wind follows it
At a past time the radar, lightning and satellite cards aged the shown frame and judged the source delayed against the wall clock, so a frame from years back read "Source observations delayed" and an age in the millions of minutes. Frame ages, the delayed status and the stale stat now count from the timeline time at a past time, and from now while live, as before. The observed timeline's readout and preview show the time alone at a past time, since its age from the timeline time is always zero. The wind card noted that it does not follow the timeline whenever the observed clock was at a past time, even when a host follows the world clock for wind. The weather clock now reports whether a layer follows the world clock (weatherClock.follows(id), the world clock's follows), and the wind row and card drop that note when its source follows the timeline.
This commit is contained in:
1 parent
7b4b4d4184
commit
6e23a73283
8 files changed
+151
-21
No files matched your search
@@ -120,9 +120,17 @@ export function createWeatherLayer({
|
||||
rendering?.cancelPrefetch?.();
|
||||
notify();
|
||||
});
|
||||
// Ages and delays are measured from the time the layer shows: the world
|
||||
// clock's time at a past time, the wall clock while live.
|
||||
const worldNow = () => {
|
||||
const shared = clock?.getState();
|
||||
return shared?.mode === 'history' && shared.target
|
||||
? Date.parse(shared.target)
|
||||
: Date.now();
|
||||
};
|
||||
const observationDelayed = () =>
|
||||
manifest?.latest &&
|
||||
Date.now() - Date.parse(manifest.latest) >
|
||||
worldNow() - Date.parse(manifest.latest) >
|
||||
(product === 'clouds' ? 240 : lightning ? 45 : 20) * 60_000;
|
||||
const stop = () => {
|
||||
if (clock) return;
|
||||
@@ -573,7 +581,7 @@ export function createWeatherLayer({
|
||||
const index = times.indexOf(time);
|
||||
const current = index >= 0;
|
||||
const age = time
|
||||
? Math.max(0, Math.floor((Date.now() - Date.parse(time)) / 60000))
|
||||
? Math.max(0, Math.floor((worldNow() - Date.parse(time)) / 60000))
|
||||
: null;
|
||||
const lag =
|
||||
age === null
|
||||
|
||||
Reference in new issue
Block a user