mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Show the timeline only while a layer with time to show is on
The bar now needs more than the world clock being away from live: a layer that moves with the clock must be on with time to show. In Core that is weather radar, satellite or lightning with frames; a host adds layers by following them. Turning the last one off hides the bar; turning it back on brings it back. The world clock reports this as `supported` in its state. Weather products register their frames as coverage one by one, suspended or not, so the way back to live stays on screen with reduced motion. Weather refreshes and satellite catalog changes tell the clock their coverage may have changed. A coverage that throws counts as none, and the clock reads its state once per notification round.
This commit is contained in:
1 parent
434fc9602d
commit
690a6637e2
12 files changed
+205
-25
No files matched your search
@@ -436,9 +436,10 @@ test('a target superseded from a listener resolves false', async (t) => {
|
||||
assert.equal(radar.shown, time(10));
|
||||
});
|
||||
|
||||
test('the observed frames are the world clock coverage, while registered', (t) => {
|
||||
test('each product’s frames are world clock coverage, and support the timeline while shown', (t) => {
|
||||
const { clock, world } = harness(t);
|
||||
assert.equal(world.coverage(), null);
|
||||
assert.equal(world.getState().supported, false);
|
||||
const radar = product('radar', [0, 10]);
|
||||
const unregister = clock.register(radar);
|
||||
clock.register(product('lightning', [5]));
|
||||
@@ -447,7 +448,48 @@ test('the observed frames are the world clock coverage, while registered', (t) =
|
||||
end: Date.parse(time(10)),
|
||||
marks: [0, 5, 10].map((m) => Date.parse(time(m))),
|
||||
});
|
||||
assert.equal(world.getState().supported, true);
|
||||
unregister();
|
||||
assert.deepEqual(world.coverage().marks, [Date.parse(time(5))]);
|
||||
clock.destroy();
|
||||
assert.equal(world.coverage(), null);
|
||||
assert.equal(world.getState().supported, false);
|
||||
});
|
||||
|
||||
test('a suspended product keeps its coverage, so the way back to live stays', (t) => {
|
||||
const { clock, world } = harness(t);
|
||||
const radar = product('radar', [0, 10]);
|
||||
clock.register(radar);
|
||||
radar.suspended = true;
|
||||
void clock.refresh();
|
||||
assert.equal(world.getState().supported, true);
|
||||
assert.deepEqual(
|
||||
world.coverage().marks,
|
||||
[0, 10].map((m) => Date.parse(time(m))),
|
||||
);
|
||||
});
|
||||
|
||||
test('new frames reach the world clock through refresh', (t) => {
|
||||
const { clock, world } = harness(t);
|
||||
const radar = product('radar', []);
|
||||
clock.register(radar);
|
||||
const supported = [];
|
||||
world.subscribe((state) => supported.push(state.supported));
|
||||
assert.equal(world.getState().supported, false);
|
||||
radar.times = [time(0)];
|
||||
void clock.refresh();
|
||||
assert.equal(supported.at(-1), true);
|
||||
});
|
||||
|
||||
test('a clock destroyed while it registers a product lets go of it', (t) => {
|
||||
const { clock, world } = harness(t);
|
||||
const off = world.subscribe(() => {
|
||||
off();
|
||||
clock.destroy();
|
||||
});
|
||||
const unregister = clock.register(product('radar', [0, 10]));
|
||||
unregister();
|
||||
assert.equal(world.follows('radar'), false);
|
||||
assert.equal(world.coverage(), null);
|
||||
assert.equal(world.getState().supported, false);
|
||||
});
|
||||
Reference in new issue
Block a user