mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Merge origin/main into the renderer seam
Brings in main up to f24abfc88: cockpit subject providers, the render
failure notice, aircraft drawn in their own mesh colours, airport ground
vehicles, and an aircraft with no ground track facing its true heading.
Under the seam:
- The render failure notice lives in the Cesium adapter
(src/render/cesium/renderFailure.js) and is the application hook
renderFailureNotice({allowReload, store}); its private Cesium fields
(Event's raise queue, the widget's render loop flag) are read through
internals.js. The inline panel's timer waits while the frame port reports
the loop stopped, and goes on after a Retry.
- Ordinary aircraft models draw white with the 'highlight' colour blend
through the draw port; tracked and emergency colours tint the mesh.
- Held trains and transit vehicles hide their route set and markers through
the draw port; the fleet model test fakes answer loads through the fake
draw port instead of Cesium's glTF loader.
- The Cockpit's subject view follows and places the camera through the
camera port.
This commit is contained in:
commit
866a9816f2
142 files changed
+9067
-308
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { cockpitProgressLayout } from '../../../cockpitProgress.js';
|
||||
|
||||
// A provider subject's progress line (src/cockpitSubjectProviders.js): a thin
|
||||
// line along the bottom of the view, its ticks, labels and marker laid out
|
||||
// at the line's own width (src/cockpitProgress.js). The part before the
|
||||
// marker is dimmed. Everything it shows is worded by the provider. It is an
|
||||
// image named by the provider's summary; with no summary it is decoration,
|
||||
// hidden from assistive technology.
|
||||
|
||||
const props = defineProps({
|
||||
progress: { type: Object, required: true },
|
||||
});
|
||||
|
||||
/** The width laid out at before the line is measured (px). */
|
||||
const FALLBACK_WIDTH_PX = 960;
|
||||
|
||||
const root = ref(null);
|
||||
const widthPx = ref(0);
|
||||
let observer = null;
|
||||
|
||||
const measure = () => {
|
||||
widthPx.value = root.value?.clientWidth || 0;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
measure();
|
||||
if (typeof ResizeObserver === 'function' && root.value) {
|
||||
observer = new ResizeObserver(measure);
|
||||
observer.observe(root.value);
|
||||
}
|
||||
});
|
||||
onBeforeUnmount(() => observer?.disconnect());
|
||||
|
||||
const width = computed(() => widthPx.value || FALLBACK_WIDTH_PX);
|
||||
const layout = computed(() =>
|
||||
cockpitProgressLayout(props.progress, width.value),
|
||||
);
|
||||
// Positions as shares of the line, so a resize between measurements keeps
|
||||
// every mark in place.
|
||||
const percent = (x) => `${((x / width.value) * 100).toFixed(3)}%`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="root" class="cockpit-progress" :role="progress.summary ? 'img' : undefined" :aria-label="progress.summary || undefined" :aria-hidden="progress.summary ? undefined : 'true'">
|
||||
<template v-if="layout">
|
||||
<div class="cockpit-progress-line" aria-hidden="true">
|
||||
<span class="cockpit-progress-travelled" :style="{ width: percent(layout.travelledX) }"></span>
|
||||
</div>
|
||||
<i v-for="(tick, index) in layout.ticks" :key="`t${index}`" class="cockpit-progress-tick" :class="{ labelled: tick.labelled, merged: tick.count > 1, travelled: tick.x <= layout.travelledX }" :data-tone="tick.tone" :style="{ left: percent(tick.x) }" aria-hidden="true"></i>
|
||||
<span v-for="(label, index) in layout.labels" :key="`l${index}`" class="cockpit-progress-label" :data-align="label.align" :data-tone="label.tone" :style="{ left: percent(label.left), width: `${label.width}px` }" aria-hidden="true"><b>{{ label.text }}</b><small v-if="label.detail">{{ label.detail }}</small></span>
|
||||
<i v-if="layout.marker" class="cockpit-progress-marker" :class="{ dwell: layout.marker.dwell }" :style="{ left: percent(layout.marker.x) }" aria-hidden="true"></i>
|
||||
<span v-if="layout.tag" class="cockpit-progress-tag" aria-hidden="true">{{ layout.tag }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -11,12 +11,27 @@ import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
const { route } = storeToRefs(useCockpitStore());
|
||||
const initial = createRouteState();
|
||||
const r = computed(() => route.value ?? initial);
|
||||
// A provider subject's card is titled by its provider, in the page's language.
|
||||
const kicker = computed(() =>
|
||||
r.value.kind === 'subject'
|
||||
? r.value.title
|
||||
: r.value.kind === 'vessel'
|
||||
? t('REPORTED VOYAGE')
|
||||
: t('ESTIMATED FLIGHT PLAN'),
|
||||
);
|
||||
const label = computed(() =>
|
||||
r.value.kind === 'subject'
|
||||
? r.value.title || undefined
|
||||
: r.value.kind === 'vessel'
|
||||
? t('Reported voyage')
|
||||
: t('Estimated flight plan'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="cockpit-route" class="cockpit-route-card" :aria-label="r.kind === 'vessel' ? t('Reported voyage') : t('Estimated flight plan')" :hidden="!r.visible">
|
||||
<section id="cockpit-route" class="cockpit-route-card" :aria-label="label" :hidden="!r.visible">
|
||||
<div class="cockpit-route-heading">
|
||||
<span class="cockpit-route-kicker">{{ r.kind === 'vessel' ? t('REPORTED VOYAGE') : t('ESTIMATED FLIGHT PLAN') }}</span>
|
||||
<span class="cockpit-route-kicker">{{ kicker }}</span>
|
||||
<small id="cockpit-route-status">{{ r.status }}</small>
|
||||
</div>
|
||||
<div class="cockpit-route-endpoints">
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<script setup>
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { msg, t } from '../../../i18n/index.js';
|
||||
import { useStatusStore } from '../../stores/status.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// Published by installRenderFailureNotice() (src/render/cesium/renderFailure.js).
|
||||
const { renderFailure: failure } = storeToRefs(useStatusStore());
|
||||
const panel = ref(null);
|
||||
const MESSAGES = {
|
||||
'context-lost': msg(
|
||||
"The browser took back the globe's 3D graphics. Layers and controls still work, but the map cannot draw until the page reloads.",
|
||||
),
|
||||
'render-error': msg(
|
||||
'Rendering stopped after an error. Layers and controls still work, but the map is not updating.',
|
||||
),
|
||||
};
|
||||
// Focus goes to the first action when the notice appears. When the globe
|
||||
// draws again, it goes back, or to the map, unless the user moved it.
|
||||
let focusBefore;
|
||||
watch(
|
||||
() => Boolean(failure.value),
|
||||
async (shown) => {
|
||||
if (shown) {
|
||||
focusBefore = document.activeElement;
|
||||
await nextTick();
|
||||
panel.value?.querySelector('button')?.focus();
|
||||
return;
|
||||
}
|
||||
if (focusBefore === undefined) return;
|
||||
const previous = focusBefore;
|
||||
focusBefore = undefined;
|
||||
await nextTick();
|
||||
const active = document.activeElement;
|
||||
if (active && active !== document.body) return;
|
||||
if (previous?.isConnected && previous !== document.body) {
|
||||
previous.focus({ preventScroll: true });
|
||||
// A control disabled, hidden or made inert meanwhile does not take it.
|
||||
if (document.activeElement === previous) return;
|
||||
}
|
||||
focusMap();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// The map's keys (Enter to finish a drawing, Space to talk) read the canvas
|
||||
// as the map. It stays focusable only until focus leaves or the globe is
|
||||
// pressed; a press leaves focus on the page, as in Cesium.
|
||||
function focusMap() {
|
||||
const canvas = document.querySelector(
|
||||
'#cesiumContainer .cesium-widget canvas',
|
||||
);
|
||||
if (!canvas) return;
|
||||
if (!canvas.hasAttribute('tabindex')) {
|
||||
canvas.tabIndex = -1;
|
||||
const done = new AbortController();
|
||||
const release = () => {
|
||||
done.abort();
|
||||
canvas.removeAttribute('tabindex');
|
||||
};
|
||||
canvas.addEventListener('blur', release, { signal: done.signal });
|
||||
canvas.addEventListener(
|
||||
'pointerdown',
|
||||
() => {
|
||||
release();
|
||||
canvas.blur();
|
||||
},
|
||||
{ capture: true, signal: done.signal },
|
||||
);
|
||||
}
|
||||
canvas.focus({ preventScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="failure" id="render-failure" ref="panel" role="alertdialog" aria-labelledby="render-failure-title" aria-describedby="render-failure-message">
|
||||
<h2 id="render-failure-title">{{ t('The globe stopped drawing') }}</h2>
|
||||
<p id="render-failure-message">{{ t(MESSAGES[failure.reason] ?? MESSAGES['render-error']) }}</p>
|
||||
<p v-if="failure.detail" class="render-failure-detail" translate="no">{{ failure.detail }}</p>
|
||||
<p v-if="failure.reset" class="render-failure-hint">{{ t('Reset view reloads the app without the view restored from the address bar.') }}</p>
|
||||
<div v-if="failure.retry || failure.reset" class="render-failure-actions">
|
||||
<UiButton v-if="failure.retry" class="gev-action-button render-failure-retry" :onClick="failure.retry">{{ failure.reason === 'context-lost' ? t('Reload') : t('Retry') }}</UiButton>
|
||||
<UiButton v-if="failure.reset" class="gev-action-button render-failure-reset" :onClick="failure.reset">{{ t('Reset view') }}</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user