mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
IntelHUD no longer builds #intel-hud with innerHTML or writes its readouts by id: it publishes its readouts, typing summary, REC blink, visibility, layout variant and style colors through its publish option to the gev-hud store, and the intel-hud application view renders them. The corners render from mount so the panel layout controllers register them as obstacles. The vessel layer presents the selected vessel's readout through src/hudReadouts.js, which IntelHUD follows, instead of writing into the HUD. The Cyber sonar state answers a HUD toggle from IntelHUD's visibility rather than the class the view renders on its next update.
36 lines
963 B
JavaScript
36 lines
963 B
JavaScript
// src/testSupport/hudReadouts.mjs — the Intel HUD's published readouts by the
|
|
// element ids its view renders them in, for tests that drive IntelHUD alone.
|
|
|
|
const FIELDS = Object.freeze({
|
|
'hud-alt': 'alt',
|
|
'hud-summary': 'summary',
|
|
'hud-mgrs': 'mgrs',
|
|
'hud-latlon': 'latlon',
|
|
'hud-bottom-line': 'bottom',
|
|
'hud-gsd': 'gsd',
|
|
'hud-coll': 'coll',
|
|
'hud-ona': 'ona',
|
|
'hud-mode': 'mode',
|
|
'hud-timestamp': 'timestamp',
|
|
});
|
|
|
|
/**
|
|
* A `publish` to hand IntelHUD and each readout's latest text.
|
|
* @returns {{publish: (view: object) => void, view: () => ?object,
|
|
* elements: Map<string, {readonly textContent: string}>}}
|
|
*/
|
|
export function hudReadouts() {
|
|
let view = null;
|
|
const elements = new Map(
|
|
Object.entries(FIELDS).map(([id, field]) => [
|
|
id,
|
|
{
|
|
get textContent() {
|
|
return view?.[field] ?? '';
|
|
},
|
|
},
|
|
]),
|
|
);
|
|
return { publish: (next) => (view = next), view: () => view, elements };
|
|
}
|