A row plays only with a timeline to play; the speed shown follows the world clock; mark labels merge whole and cut by character

A weather row's play started the world clock even with no time to show,
where there is no timeline; it now does nothing then, as the timeline's
own Play cannot be reached. A weather layer made without a weather clock
does nothing once destroyed, so enabling it after builds no clock.

The timeline's speed follows the world clock's rate whoever set it, and
its Play runs at that rate, so it and a row's play never run at different
rates; a rate not offered shows as the nearest offered speed. Choosing a
speed sets the clock's rate first, also while a driver steps.

Marks merge on their whole label and are cut for showing after, so two
whose labels only differ past the cut stay two, and the cut counts
graphemes (code points where the runtime cannot tell them), so an emoji is
never split.

Tests that compared a DOM element with null built an assertion message
from the element when they failed, which hung the run; they compare plain
values now, so they fail at once. The timeline tests put the clock back to
real time after each.
This commit is contained in:
Sameh Khamis committed 2026-11-14 21:12:43 -08:00
1 parent 1dc2dbe4ea
commit ac04812db2
26 files changed
+274 -108

No files matched your search

+16 -9
View File
@@ -58,8 +58,8 @@ const utc = (value) =>
/**
* Move `world`, the world clock, as its timeline does: `play` toggles play at
* the world clock's rate (the speed the timeline chose), from the start of the
* covered time when live or at its end, unless `canPlay` is false; `latest`
* goes live. `step` (-1 or 1) goes to the previous or next of `frames`, the
* covered time when live or at its end, unless `canPlay` is false or there
* is no covered time (no timeline to play); `latest` goes live. `step` (-1 or 1) goes to the previous or next of `frames`, the
* weather frames; the timeline does not mark them, so this is the row's own
* way to step through them.
*/
@@ -68,13 +68,16 @@ function moveWorldTime(world, frames, { play, latest, step }, canPlay) {
if (play === true) {
const state = world.getState();
if (state.playing) world.pause();
else if (canPlay) {
const covered = world.coverage();
// The covered time reaches to now, as the timeline's track does.
const end = covered && Math.max(covered.end, world.wallNow());
if (covered && (state.live || state.timeMs >= end))
world.seek(Math.min(covered.start, state.timeMs));
world.play({ continuous: true });
else {
// With no time to show there is no timeline, and nothing to play.
const covered = canPlay && state.supported ? world.coverage() : null;
if (covered) {
// The covered time reaches to now, as the timeline's track does.
const end = Math.max(covered.end, world.wallNow());
if (state.live || state.timeMs >= end)
world.seek(Math.min(covered.start, state.timeMs));
world.play({ continuous: true });
}
}
}
if (latest === true) world.goLive();
@@ -153,6 +156,7 @@ export function createWeatherLayer({
manifest = null,
request = null,
listener = null;
let destroyed = false;
let enabled = false,
loading = false;
let generation = 0,
@@ -366,6 +370,8 @@ export function createWeatherLayer({
notify();
},
enable() {
// Destroyed, the layer stays off: no clock is built for it again.
if (destroyed) return;
enabled = true;
ensureClock();
if (!removeCamera) {
@@ -870,6 +876,7 @@ export function createWeatherLayer({
};
},
destroy() {
destroyed = true;
layer.disable();
unsubscribeClock?.();
unsubscribeClock = null;