mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Timeline marks carry labels; a tap by a tick goes to its mark
A layer's world clock coverage may now give each mark as an object,
{ time, label?, id?, kind? }, as well as a bare epoch ms number, and the
two may be mixed. worldClock.coverage() keeps marks as the sorted list of
distinct times, so existing readers are unchanged, and adds markDetails:
the merged marks in time order (then kind, label and id), each frozen and
holding only the fields given. Marks given alike by several sources appear
once, a bare time is dropped where a labelled mark shares it, and a mark
with no finite time is ignored. The contract is documented in the
worldClock JSDoc and docs/APPLICATION.md.
Launches label their marks with the mission's name (the launch's where it
has none), cut to 27 characters in capitals as the mission index shows
names. Earthquakes of magnitude 6 and up label theirs with the magnitude
as the map shows it and the feed's place cut to 40 characters, such as
"M6.4 · 113 km SSE of Lata, Solomon Islands"; the layer now tells the clock
when the labels change as well as the times.
On the timeline, a pointer within 6 px of a tick shows its label over the
track (nothing for an unlabelled mark), and a tap there goes exactly to
the mark's time instead of the point tapped. A tap elsewhere and a drag
work as before, and ticks stay ticks. The arrow keys still step from mark
to mark; with the handle on a mark, its labels follow the time in the
handle's aria-valuetext, and show over the track while it has focus.
This commit is contained in:
1 parent
900c76425c
commit
4f23ad330c
17 files changed
+487
-48
No files matched your search
@@ -147,6 +147,9 @@ function restoreCameraView(viewer, view, landedView) {
|
||||
camera.setView(view);
|
||||
}
|
||||
|
||||
/** The longest name a timeline mark carries, as in the mission index. */
|
||||
const MARK_LABEL_LENGTH = 27;
|
||||
|
||||
export function createLifecycle({
|
||||
state: layerState,
|
||||
services,
|
||||
@@ -156,18 +159,30 @@ export function createLifecycle({
|
||||
const { holdContinuousRender, releaseContinuousRender } = services.render;
|
||||
let hover = null;
|
||||
// While on, the launches loaded span the time from the first to the last,
|
||||
// each one a mark. Registered once; off, the layer has no time to show, and
|
||||
// each step tells the clock once it has settled.
|
||||
// each one a mark labelled with its mission's name (the launch's where it
|
||||
// has none), cut short and in capitals as the mission index shows names.
|
||||
// Registered once; off, the layer has no time to show, and each step tells
|
||||
// the clock once it has settled.
|
||||
worldClock.register({
|
||||
id: 'rocket-launches',
|
||||
coverage: () => {
|
||||
if (!layerState._enabled) return null;
|
||||
const marks = layerState._launches
|
||||
.map((launch) => Date.parse(launch.launchTime))
|
||||
.filter(Number.isFinite)
|
||||
.sort((a, b) => a - b);
|
||||
.map((launch) => ({
|
||||
time: Date.parse(launch.launchTime),
|
||||
label: parts.overlays
|
||||
.shortMissionLabel(
|
||||
launch.missionName || launch.name,
|
||||
MARK_LABEL_LENGTH,
|
||||
)
|
||||
.toUpperCase(),
|
||||
...(launch.id != null ? { id: String(launch.id) } : {}),
|
||||
kind: 'launch',
|
||||
}))
|
||||
.filter(({ time }) => Number.isFinite(time))
|
||||
.sort((a, b) => a.time - b.time);
|
||||
if (!marks.length) return null;
|
||||
return { start: marks[0], end: marks.at(-1), marks };
|
||||
return { start: marks[0].time, end: marks.at(-1).time, marks };
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user