mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Take the timeline commits back out before merging their reviewed versions from main
5150279cc,97bd61711,900c76425and4f23ad330went to main, reviewed and changed, as #1745. They are taken out here so main brings them in as merged, rather than as two copies of the same changes in conflict.
This commit is contained in:
1 parent
4f23ad330c
commit
961e6321a5
45 files changed
+1316
-1078
No files matched your search
+38
-10
@@ -98,6 +98,13 @@ export function createWeatherPanel({
|
||||
openPanels.set(page, id);
|
||||
render();
|
||||
},
|
||||
transport: {
|
||||
onCommit: (tick) => clock?.setTarget(tick),
|
||||
onPreview: (time) => historyTime(time, clock?.getState()),
|
||||
onStep: (direction) => clock?.step(direction),
|
||||
onLatest: () => clock?.latest(),
|
||||
onPlay: () => clock?.togglePlay(),
|
||||
},
|
||||
};
|
||||
// The readout patches synchronously, so a newly opened card can be measured.
|
||||
const paint = (view) =>
|
||||
@@ -106,7 +113,14 @@ export function createWeatherPanel({
|
||||
hidden: true,
|
||||
observed: false,
|
||||
scope: '',
|
||||
frameTime: '',
|
||||
timeline: {
|
||||
ticks: [],
|
||||
index: 0,
|
||||
mode: 'latest',
|
||||
playing: false,
|
||||
readout: '',
|
||||
disabled: true,
|
||||
},
|
||||
cards: [],
|
||||
observedCards: [],
|
||||
});
|
||||
@@ -121,18 +135,32 @@ export function createWeatherPanel({
|
||||
.filter(({ summary }) => summary)
|
||||
.sort((a, b) => ORDER.indexOf(a.id) - ORDER.indexOf(b.id));
|
||||
const observed = active.filter(({ id }) => OBSERVED.has(id));
|
||||
const showObserved = observed.length > 0;
|
||||
const showTimeline = observed.length > 0;
|
||||
const names = {
|
||||
'weather-radar': t('Rain radar'),
|
||||
'weather-satellite': t('Satellite clouds'),
|
||||
'weather-lightning': t('Lightning density'),
|
||||
};
|
||||
// While live, the newest frame and its age; at a past time, the timeline
|
||||
// time alone. The world timeline moves the time.
|
||||
const shownTime =
|
||||
state.mode === 'latest' ? state.timeline.at(-1) : state.target;
|
||||
const frameTime =
|
||||
showObserved && shownTime ? historyTime(shownTime, state) : '';
|
||||
const index =
|
||||
state.mode === 'latest'
|
||||
? state.timeline.length - 1
|
||||
: Math.max(
|
||||
0,
|
||||
state.timeline.findLastIndex(
|
||||
(tick) => Date.parse(tick) <= Date.parse(state.target),
|
||||
),
|
||||
);
|
||||
const timeline = {
|
||||
ticks: state.timeline,
|
||||
index,
|
||||
mode: state.mode,
|
||||
playing: Boolean(state.playing),
|
||||
disabled: !showTimeline || state.timeline.length < 2,
|
||||
readout:
|
||||
state.mode === 'latest'
|
||||
? t('LATEST · newest per product')
|
||||
: historyTime(state.target, state),
|
||||
};
|
||||
const models = active.map((entry) => {
|
||||
const { id, icon, summary, legend = [], list } = entry;
|
||||
// Discrete classes (storm geometry, AQHI bands) list swatches, not a ramp.
|
||||
@@ -217,9 +245,9 @@ export function createWeatherPanel({
|
||||
const hidden = active.length === 0;
|
||||
paint({
|
||||
hidden,
|
||||
observed: showObserved,
|
||||
observed: showTimeline,
|
||||
scope: observed.map(({ id }) => names[id]).join(' · '),
|
||||
frameTime,
|
||||
timeline,
|
||||
cards: models.filter(({ id }) => !OBSERVED.has(id)),
|
||||
observedCards: models.filter(({ id }) => OBSERVED.has(id)),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user