feat(cockpit): keep the orbital camera on a ground target

In the satellite orbital view a single click on a mapped ground point (a
ground point of a layer that is on, such as a Mapped Installations site, a
fire or a local data pack feature) keeps the camera on it. Each frame the
look is aimed from the satellite's position to the point's Earth-fixed
position in the track-up nadir frame the arrows tilt, so the point stays
at the centre as the satellite moves. The swing onto the point, or between
points, uses the arrows' easing on a slower clock and then holds the point
exactly; reduced motion cuts.

A click elsewhere, FOCUS on the focused point, NADIR, Home or 0 ends the
focus and the view eases back to nadir; an arrow ends it and tilts on from
where the view is. The focus also ends, easing back, when the point leaves
the ±45° reach or the satellite's horizon, when its layer is turned off or
its record is dropped, and with the view. While focused the readout gives
the single off-nadir angle to the point (OFF-NADIR 23.4°), names it in a
polite live region, and the swath reads approximate as for a tilt. Clicks
still reach Cesium's own handler and never untrack the satellite; a click
a tool owns is ignored.

Under the readout, IN REACH lists the mapped points facing the satellite
that are within the reach or in the frame, nearest to nadir first and at
most 12, rebuilt once a second. A row opens the point's position, source
and OpenStreetMap tags (or its layer's properties); FOCUS focuses it,
switches to it, or ends the focus held on it, and is unavailable for a
point in frame but beyond the reach.
This commit is contained in:
Denis Groshev committed 2026-11-09 01:56:29 +01:00
1 parent 745c11969b
commit 567c833582
24 files changed
+2132 -19

No files matched your search

+11 -1
View File
@@ -14,6 +14,7 @@ import {
shownOwnerMark,
} from '../../ownerFlag.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import CockpitOrbitalReach from './CockpitOrbitalReach.vue';
// The orbital view's HUD: a nadir reticle over the picture, the satellite's
// identity and orbit, and the optical zoom. The Cockpit controller presents
@@ -254,6 +255,12 @@ watch(
// The off-nadir tilt; an untilted view shows no readout or reset.
const look = computed(() => orbital.value?.look || { offset: false });
// A ground focus names its target in a polite live region; the angle,
// which changes every update, is left out of it.
const focusText = computed(() => {
const label = look.value.focus?.label;
return label ? t('FOCUS · {name}', { name: label }) : '';
});
const transition = computed(() => orbital.value?.transition || {});
const lensStyle = computed(() => {
@@ -317,9 +324,12 @@ const lensStyle = computed(() => {
<p class="cockpit-orbital-north">{{ trackUp ? t('TRACK UP') : t('NORTH UP') }}</p>
<!-- Shown only while the view is tilted off nadir: where it looks and the way back. -->
<div v-if="look.offset" class="cockpit-orbital-look">
<span id="cockpit-orbital-look-readout" class="cockpit-orbital-look-readout" aria-live="polite">{{ look.readout }}</span>
<span id="cockpit-orbital-look-readout" class="cockpit-orbital-look-readout" :aria-live="look.focus ? 'off' : 'polite'">{{ look.readout }}</span>
<button id="cockpit-orbital-nadir" ref="nadirButton" type="button" class="cockpit-orbital-nadir" :aria-label="t('Return the view to nadir')" :title="t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ t('NADIR') }}</button>
</div>
<p id="cockpit-orbital-focus" class="cockpit-orbital-focus" aria-live="polite">{{ focusText }}</p>
<!-- The mapped points the view shows or can be turned to, each with FOCUS. -->
<CockpitOrbitalReach />
</div>
<div class="cockpit-orbital-optics">
<button id="cockpit-orbital-zoom-out" ref="zoomOutButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</button>
+109
View File
@@ -0,0 +1,109 @@
<script setup>
import { storeToRefs } from 'pinia';
import { computed, nextTick, ref, useTemplateRef, watch } from 'vue';
import { formatNumber, t } from '../../../i18n/index.js';
import { formatCockpitCoordinate } from '../../cockpitPresentation.js';
import { useCockpitStore } from '../../stores/cockpit.js';
// The mapped points the orbital view shows or can be turned to, under its
// readout: ground points of the layers that are on, nearest to nadir first.
// A row opens the point's details (its OpenStreetMap tags where the layer
// keeps them); FOCUS keeps the camera on it, switches to it from another, or
// ends the focus held on it. The Cockpit controller builds the list
// (src/ui/cockpitOrbitalFocus.js) and keeps FOCUS's delegated listener;
// which rows are open is this view's own.
const { orbitalReach } = storeToRefs(useCockpitStore());
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
const entries = computed(() => orbitalReach.value?.entries || []);
const count = computed(() =>
finite(orbitalReach.value?.count) ? orbitalReach.value.count : 0,
);
const open = ref(false);
const selectedKey = ref(null);
const root = useTemplateRef('root');
const toggleText = computed(() =>
t('IN REACH · {count}', { count: formatNumber(count.value) }),
);
const moreText = computed(() =>
count.value > entries.value.length
? t('NEAREST {shown} OF {count}', {
shown: formatNumber(entries.value.length),
count: formatNumber(count.value),
})
: '',
);
const angleText = (deg) =>
finite(deg)
? `${formatNumber(deg, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}°`
: '—';
const positionText = (entry) =>
finite(entry.latitude) && finite(entry.longitude)
? `${formatCockpitCoordinate(entry.latitude, 'N', 'S')} ${formatCockpitCoordinate(entry.longitude, 'E', 'W')}`
: '—';
function toggleDetails(key) {
selectedKey.value = selectedKey.value === key ? null : key;
}
// A point that leaves the list closes its details. Keyboard focus inside
// its row moves to the list's toggle, which stays, instead of the page.
watch(
entries,
(list) => {
const key = selectedKey.value;
const active = document.activeElement;
const row = active?.closest?.('[data-orbital-reach-key]');
const leaving =
row &&
root.value?.contains(row) &&
!list.some((entry) => entry.key === row.dataset.orbitalReachKey);
if (key !== null && !list.some((entry) => entry.key === key))
selectedKey.value = null;
if (leaving)
nextTick(() =>
root.value
?.querySelector('#cockpit-orbital-reach-toggle')
?.focus({ preventScroll: true }),
);
},
{ flush: 'pre' },
);
</script>
<template>
<section ref="root" class="cockpit-orbital-reach" :aria-label="t('Mapped points in reach')">
<button id="cockpit-orbital-reach-toggle" type="button" class="cockpit-orbital-reach-toggle" :aria-expanded="String(open)" aria-controls="cockpit-orbital-reach-body" :aria-label="open ? t('Hide the mapped points in reach') : t('Show the mapped points in reach')" :title="open ? t('Hide the mapped points in reach') : t('Show the mapped points in reach')" @click="open = !open">{{ toggleText }}</button>
<div v-show="open" id="cockpit-orbital-reach-body" class="cockpit-orbital-reach-body">
<p v-if="!entries.length" class="cockpit-orbital-reach-empty">{{ t('NOTHING MAPPED IN REACH') }}</p>
<ul v-else class="cockpit-orbital-reach-list">
<li v-for="entry in entries" :key="entry.key" class="cockpit-orbital-reach-item" :class="{ 'cockpit-orbital-reach-focused': entry.focused }" :data-orbital-reach-key="entry.key">
<div class="cockpit-orbital-reach-row">
<button type="button" class="cockpit-orbital-reach-name" :aria-expanded="String(selectedKey === entry.key)" :aria-controls="selectedKey === entry.key ? 'cockpit-orbital-reach-details' : undefined" @click="toggleDetails(entry.key)">
<strong>{{ entry.label }}</strong>
<small>{{ entry.layerName }}<template v-if="entry.layerName"> · </template>{{ angleText(entry.offNadirDeg) }}</small>
</button>
<button type="button" class="cockpit-orbital-reach-focus" :data-orbital-focus="entry.key" :aria-pressed="String(entry.focused)" :aria-disabled="entry.reachable ? undefined : 'true'" :aria-label="t('Keep the camera on {name}', { name: entry.label })" :title="entry.reachable ? t('Keep the camera on {name}', { name: entry.label }) : t('Beyond the off-nadir reach')">{{ t('FOCUS') }}</button>
</div>
<div v-if="selectedKey === entry.key" id="cockpit-orbital-reach-details" class="cockpit-orbital-reach-details">
<p class="cockpit-orbital-reach-where">{{ positionText(entry) }}<template v-if="entry.source"> · {{ entry.source }}</template></p>
<template v-if="entry.details.length">
<p class="cockpit-orbital-reach-kicker">{{ entry.osm ? t('OPENSTREETMAP TAGS') : t('DETAILS') }}</p>
<dl class="cockpit-orbital-reach-tags" translate="no">
<div v-for="row in entry.details" :key="row.key" class="cockpit-orbital-reach-tag">
<dt>{{ row.key }}</dt>
<dd>{{ row.value }}</dd>
</div>
</dl>
</template>
</div>
</li>
</ul>
<p v-if="moreText" class="cockpit-orbital-reach-more">{{ moreText }}</p>
</div>
</section>
</template>