mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Display > HUD > Sonar now turns the sonar sweep on over Tactical or Minimal. It is off by default, ON reveals its five sliders, and it keeps its guards: an OFF control, the sweep only while the HUD is visible and outside Cockpit, no animation under reduced motion, and repaint timers re-armed only after a drawn frame that still shows contacts. The Cyber layout, its shell skin and its Cockpit lanes are removed. Share links, scenes, saved views and set_hud that name Cyber open Tactical with Sonar on; links and scene shots record Tactical with Sonar under the same code, and a restored state that names another layout turns Sonar off. set_cyber_sonar keeps its name and works under any layout. A newer Sonar toggle or voice setting wins over a share-link restore that lands later. From 1200px wide the command dock and World Timeline sit 74px above the bottom edge, as in the Omnibar layout, leaving the bottom row to the map attribution (left) and the Power Up corner row (right). The attribution moves to the bottom right when the page runs right to left, where the corner row sits at the bottom left, and a long credit line wraps upward before reaching the corner row. The Tactical bottom-right readout sits 8px above Power Up and the coordinates start level with it. The World Timeline is narrowed to sit between the corners. Toasts keep clear of the raised dock and the chat and voice panel height budgets subtract its rise. Below 1200px the layout is unchanged. The left rail treats the centered World Timeline and voice control as obstacles only where they reach a laid-out panel. On top of the Omnibar: sonar.css replaces cyber.css after the Omnibar imports, the Omnibar's HUD guide step now says Layout picks Tactical or Minimal, and the Omnibar's Tactical bottom-right readout keeps the same 8px above Power Up. Co-authored-by: Sameh Khamis <[email protected]>
212 lines
7.6 KiB
JavaScript
212 lines
7.6 KiB
JavaScript
import { createFrameRateMonitor } from './frameRateMonitor.js';
|
|
import { bindApplicationShortcuts } from './visualInput.js';
|
|
import { useDisplayStore } from './stores/display.js';
|
|
import { applicationPinia } from './vueRuntime.js';
|
|
|
|
/** Own keyboard/display event subscriptions; settings remain with their state owners. */
|
|
export class DisplayBindings {
|
|
constructor({
|
|
viewer,
|
|
services,
|
|
elements,
|
|
operations,
|
|
readState,
|
|
claimDetection,
|
|
displayStore,
|
|
}) {
|
|
Object.assign(
|
|
this,
|
|
{ viewer, services, readState, claimDetection, displayStore },
|
|
elements,
|
|
operations,
|
|
);
|
|
}
|
|
get shareLinkManager() {
|
|
return this.readState().shareLinkManager;
|
|
}
|
|
get hud() {
|
|
return this.readState().hud;
|
|
}
|
|
get bloomEnabled() {
|
|
return this.readState().bloomEnabled;
|
|
}
|
|
get sharpenEnabled() {
|
|
return this.readState().sharpenEnabled;
|
|
}
|
|
get celestialRing() {
|
|
return this.readState().celestialRing;
|
|
}
|
|
get celestialRingEnabled() {
|
|
return this.readState().celestialRingEnabled;
|
|
}
|
|
get _models3dEnabled() {
|
|
return this.readState()._models3dEnabled;
|
|
}
|
|
_initUI() {
|
|
const { cycleDetectionMode, isScopeMaskEnabled } = this.services;
|
|
this._applicationShortcuts?.destroy();
|
|
this._frameRateMonitor?.destroy();
|
|
this._frameRateMonitor = createFrameRateMonitor({
|
|
viewer: this.viewer,
|
|
documentRef: document,
|
|
});
|
|
this._applicationShortcuts = bindApplicationShortcuts({
|
|
documentRef: document,
|
|
searchInput: this._locationSearch,
|
|
actions: {
|
|
setStyle: (style) => this.setStyle(style),
|
|
dismissSearch: () => this._closeLocationSearch?.({ ifOpen: true }),
|
|
toggleHud: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.hud.toggle();
|
|
this._updateHudButtonState();
|
|
this._syncShareState();
|
|
},
|
|
toggleOrbit: () => this._toggleOrbit(),
|
|
toggleCleanView: () => this.toggleCleanView(),
|
|
toggleLayers: () =>
|
|
document.getElementById('data-panel').classList.toggle('active'),
|
|
cycleDetection: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.claimDetection();
|
|
cycleDetectionMode();
|
|
this._syncShareState();
|
|
},
|
|
toggleCctv: () => this._toggleCctvEnabled(),
|
|
},
|
|
});
|
|
|
|
this._setScope({ enabled: isScopeMaskEnabled() }, { apply: false });
|
|
// The Display controls (and the dock's style buttons) answer through
|
|
// the display store; DisplayPanel's events call these actions.
|
|
this._detachDisplayControls?.();
|
|
const store = this.displayStore ?? useDisplayStore(applicationPinia());
|
|
const token = store.connect({
|
|
setStyle: (style) => this.setStyle(style),
|
|
toggleBloom: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setBloomEnabled(!this.bloomEnabled);
|
|
},
|
|
setBloomIntensity: (value) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setBloomIntensity(value);
|
|
},
|
|
toggleSharpen: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setSharpenEnabled(!this.sharpenEnabled);
|
|
},
|
|
setScopeEnabled: (enabled) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setScope({ enabled });
|
|
this._syncShareState();
|
|
},
|
|
setScopeFeather: (value) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setScope({ featherPct: value });
|
|
this._syncShareState();
|
|
},
|
|
setScopeOpacity: (value) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setScope({ opacityPct: Number(value) });
|
|
this._syncShareState();
|
|
},
|
|
setSharpenIntensity: (pct) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setSharpenIntensity(pct);
|
|
},
|
|
setHudLayout: (value) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setHudVariant(value);
|
|
},
|
|
toggleCleanView: () => this.toggleCleanView(),
|
|
exitCleanView: () => this.toggleCleanView(false),
|
|
setDensity: (value) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.claimDetection();
|
|
this._setDetectionDensity(value);
|
|
this._syncShareState();
|
|
},
|
|
setAllocation: (value) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.claimDetection();
|
|
this._setDetectionAllocation(value);
|
|
},
|
|
setFade: (fadePct) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setDetectionFade({ fadePct });
|
|
this._syncShareState();
|
|
},
|
|
setOutsideOpacity: (outsideOpacityPct) => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setDetectionFade({ outsideOpacityPct });
|
|
this._syncShareState();
|
|
},
|
|
toggleCelestial: () => {
|
|
const ringIsVisible = !!this.celestialRing?.visible;
|
|
if (!this.celestialRingEnabled || !ringIsVisible) {
|
|
this.setCelestialRingEnabled(true, { focus: true });
|
|
} else {
|
|
this.setCelestialRingEnabled(false);
|
|
}
|
|
},
|
|
toggleHud: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.hud.toggle();
|
|
this._updateHudButtonState();
|
|
this._syncShareState();
|
|
},
|
|
toggleSonar: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this._setCyberSonarEnabled();
|
|
},
|
|
setSonarRings: (value) => this._setCyberSonarSetting('rings', value),
|
|
setSonarRange: (value) => this._setCyberSonarSetting('range', value),
|
|
setSonarIntensity: (value) =>
|
|
this._setCyberSonarSetting('intensity', value),
|
|
setSonarOpacity: (value) => this._setCyberSonarSetting('opacity', value),
|
|
setSonarSector: (value) => this._setCyberSonarSetting('sector', value),
|
|
cycleDetection: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.claimDetection();
|
|
cycleDetectionMode();
|
|
this._syncShareState();
|
|
},
|
|
toggleModels: () => {
|
|
this._setModels3dEnabled(!this._models3dEnabled);
|
|
this._syncModels3dModeRow();
|
|
},
|
|
setModelsMode: (mode) => this._setModels3dMode(mode),
|
|
// Back to the out-of-the-box look: Normal style, the global post
|
|
// defaults (bloom, sharpen, HUD, labels, celestial), scope on at full
|
|
// feather and opacity, 3D aircraft on in Proximity.
|
|
resetVisual: () => {
|
|
this.shareLinkManager?.claimRestoreLane?.('visual');
|
|
this.setStyle('normal');
|
|
// The HUD layout and the Sonar style stay as the viewer set them.
|
|
this._applyGlobalPostDefaults({ keepHudVariant: true });
|
|
this._setDetectionAllocation('ELASTIC');
|
|
this._setScope({ enabled: true, featherPct: 100, opacityPct: 100 });
|
|
this._setModels3dEnabled(true);
|
|
this._setModels3dMode('proximity');
|
|
this._syncModels3dModeRow?.();
|
|
// Inside Contacts the detection shown is lent for the session, and
|
|
// leaving puts back the state from before. A reset there is the user's
|
|
// choice, so the defaults become what leaving puts back and what a
|
|
// share link carries.
|
|
this.claimDetection();
|
|
this._adoptDetectionAsRestore?.();
|
|
this._syncShareState();
|
|
},
|
|
});
|
|
this._detachDisplayControls = () => store.detach(token);
|
|
}
|
|
destroy() {
|
|
this._applicationShortcuts?.destroy();
|
|
this._applicationShortcuts = null;
|
|
this._frameRateMonitor?.destroy();
|
|
this._frameRateMonitor = null;
|
|
this._detachDisplayControls?.();
|
|
this._detachDisplayControls = null;
|
|
}
|
|
}
|