mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
feat(hud): render the Intel HUD from a store
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.
This commit is contained in:
1 parent
b96cc37ab5
commit
c03b4a7643
26 files changed
+556
-243
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// 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 };
|
||||
}
|
||||
Reference in new issue
Block a user