mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Keep Context's follow, clicks, Radio, Cockpit entry and credits right
- Following comes only from the camera's own follow, never claimed ahead of it; vessels, which the camera does not follow, are flown to. - A drag or a long press never selects, and only a clean click on open map closes the card; a card painted on the overlay is not open map. - Closing the card lets go through its own layer only, as the person's action, leaving other layers' selections alone. - Radio's panel, with its local SDR tuner, shows whether or not the Radio layer is on; Contacts' Cockpit entry hides only while the card offers its own. - Expanded Context keeps the credits beside it right to left and with the minimal HUD. - Context counts as closed until its panel says it is open; closed, the card's refresh and the view reading pause, and opening reads the view. - The five-minute re-read fetches again past the caches, keeps what is shown meanwhile, and an empty brief is not kept. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
547687fecf
commit
57f9c03eaa
10 files changed
+599
-188
No files matched your search
@@ -53,18 +53,19 @@ const pickRadius = (index) => setContextRadiusKm(CONTEXT_RADIUS_STEPS[index]);
|
||||
const firesOn = () =>
|
||||
Boolean((omnibar.controls?.layers() || []).find((layer) => layer.id === HAZARD_LAYER.hotspots)?.enabled);
|
||||
|
||||
async function read(lat, lon) {
|
||||
if (readAt && distanceKm(readAt, { lat, lon }) <= props.settleKm) return;
|
||||
async function read(lat, lon, { force = false } = {}) {
|
||||
if (!force && readAt && distanceKm(readAt, { lat, lon }) <= props.settleKm) return;
|
||||
readAt = { lat, lon };
|
||||
const mine = ++reading;
|
||||
const mineHazards = ++readingHazards;
|
||||
loading.value = true;
|
||||
// A forced re-read keeps what is shown until the new reading lands.
|
||||
if (!force) loading.value = true;
|
||||
const [nextBrief, nextHazards] = await Promise.all([
|
||||
regionalBrief(lat, lon, store.readBrief),
|
||||
hazardsNear(lat, lon, radiusKm.value, { fires: firesOn() }).catch(() => []),
|
||||
regionalBrief(lat, lon, store.readBrief, { force }),
|
||||
hazardsNear(lat, lon, radiusKm.value, { fires: firesOn(), force }).catch(() => []),
|
||||
]);
|
||||
if (reading !== mine) return;
|
||||
brief.value = nextBrief;
|
||||
if (nextBrief || !force) brief.value = nextBrief;
|
||||
// A radius change meanwhile has its own, newer hazard read.
|
||||
if (readingHazards === mineHazards) hazards.value = nextHazards;
|
||||
loading.value = false;
|
||||
@@ -91,10 +92,7 @@ watch(radiusKm, (km) => void rereadHazards(km));
|
||||
const REREAD_MS = 5 * 60_000;
|
||||
let rereadTimer = 0;
|
||||
onMounted(() => {
|
||||
rereadTimer = setInterval(() => {
|
||||
readAt = null;
|
||||
void read(props.lat, props.lon);
|
||||
}, REREAD_MS);
|
||||
rereadTimer = setInterval(() => void read(props.lat, props.lon, { force: true }), REREAD_MS);
|
||||
});
|
||||
onBeforeUnmount(() => clearInterval(rereadTimer));
|
||||
// Hazard rows are worded as they are read, so a new language reads them again.
|
||||
|
||||
Reference in new issue
Block a user