mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Rebuild the Context panel around the selected item and the view
Clicking anything a layer can identify opens one card in Context: a hero tile (route globe and 3D model for a flight, the camera for CCTV, headline figures otherwise), its facts, actions with Cockpit or the orbital view as the primary one, and a standard set of nearby blocks (weather and local time, flights, vessels, hazards, alerts) within one radius the user sets. Aircraft show altitude as a graph. Things that move are followed when picked, and a card closes when its layer is turned off. With nothing selected the panel describes the view: the layers that are on with a breakdown of what each holds, the camera's height, what is in view, then time, weather and local news. From far out it shows worldwide counts per layer. A search field in the header narrows whatever the panel shows. Prototype. Context reads weather and hazard feeds while its panel is closed, the two 3D previews on a flight card repaint continuously, Follow can show pressed after tracking has ended elsewhere, and most new strings are fixed English. Same-named sites are told apart by position, not by a stable id.
This commit is contained in:
1 parent
f7f18c2823
commit
cc83763452
21 files changed
+6595
-1
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
// How far out Context looks for what is "nearby": one distance for every
|
||||
// nearby block (flights, vessels, hazards, alerts, other loaded items). The
|
||||
// control in the Context panel steps through a few distances; the choice is
|
||||
// kept for the next visit.
|
||||
const KEY = 'gev.contextRadiusKm';
|
||||
|
||||
/** The distances the control steps through, in km. */
|
||||
export const CONTEXT_RADIUS_STEPS = Object.freeze([25, 50, 100, 250, 500, 1000, 2500]);
|
||||
export const DEFAULT_CONTEXT_RADIUS_KM = 250;
|
||||
|
||||
/** The step closest to a distance; the default for anything unusable. */
|
||||
export function nearestRadiusStep(km) {
|
||||
const value = Number(km);
|
||||
if (!Number.isFinite(value) || value <= 0) return DEFAULT_CONTEXT_RADIUS_KM;
|
||||
return CONTEXT_RADIUS_STEPS.reduce((best, step) =>
|
||||
Math.abs(step - value) < Math.abs(best - value) ? step : best,
|
||||
);
|
||||
}
|
||||
|
||||
function read() {
|
||||
try {
|
||||
const saved = globalThis.localStorage?.getItem(KEY);
|
||||
return saved === null || saved === undefined
|
||||
? DEFAULT_CONTEXT_RADIUS_KM
|
||||
: nearestRadiusStep(saved);
|
||||
} catch {
|
||||
return DEFAULT_CONTEXT_RADIUS_KM;
|
||||
}
|
||||
}
|
||||
|
||||
/** The radius every nearby block uses, in km. */
|
||||
export const contextRadiusKm = ref(read());
|
||||
|
||||
export function setContextRadiusKm(km) {
|
||||
contextRadiusKm.value = nearestRadiusStep(km);
|
||||
try {
|
||||
globalThis.localStorage?.setItem(KEY, String(contextRadiusKm.value));
|
||||
} catch {
|
||||
// Without storage the choice lasts for this visit.
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user