mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-10 13:22:18 +00:00
Cesium stops its render loop after a render error and offers only a panel that dismisses itself, and a lost WebGL context never draws again, so the globe froze or went black while the controls kept responding. The scene chrome now shows an alert dialog with the error. Retry restarts the render loop and keeps the notice until a frame renders without an error; after a lost context it reloads the page, whose address keeps the view. Reset view opens the app root without the restored hash or share path. An inline conversation panel never reloads its host page. The application viewer turns off Cesium's own panel; other callers keep it.
90 lines
2.9 KiB
JavaScript
90 lines
2.9 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* The scene's status chips as their views render them. ShellFeedback
|
|
* (src/ui/shellFeedback.js) publishes the top-center loading status and the
|
|
* road network chip, CctvControls the camera grid chip; the toast shows
|
|
* what any owner's createToast() (src/ui/toast.js) publishes, and the title
|
|
* bar the FPS readout createFrameRateMonitor() publishes. Each label keeps its
|
|
* last text while hidden, so the next change flaps from what was shown. The
|
|
* render failure notice is what installRenderFailureNotice()
|
|
* (src/ui/renderFailure.js) publishes while the globe cannot draw.
|
|
*/
|
|
export const useStatusStore = defineStore('gev-status', () => {
|
|
/**
|
|
* `{hidden, state, label, detail, stopped}`; null until first published.
|
|
* `stopped` rests a label for good once its owner is destroyed.
|
|
*/
|
|
const loading = shallowRef(null);
|
|
/** `{visible, label, immediate, progress, stopped}`, or null. */
|
|
const traffic = shallowRef(null);
|
|
/** `{visible, label, immediate, progress, stopped}`, or null. */
|
|
const cctv = shallowRef(null);
|
|
|
|
/**
|
|
* The page toast, `{text, visible, shown}`; null until the first one.
|
|
* `shown` changes with every show, which rewrites the text.
|
|
*/
|
|
const toast = shallowRef(null);
|
|
|
|
/**
|
|
* The title bar's FPS readout, `{visible, text}`; null while no monitor
|
|
* counts frames.
|
|
*/
|
|
const fps = shallowRef(null);
|
|
|
|
/**
|
|
* The globe's render failure, `{reason, detail, shown, retry, reset}`; null
|
|
* while the globe draws. `reason` is 'render-error' or 'context-lost',
|
|
* `shown` changes each time the notice appears, and `retry` and `reset` are
|
|
* null where that action is not offered.
|
|
*/
|
|
const renderFailure = shallowRef(null);
|
|
|
|
/** @param {?object} next A fresh presentation of the loading status. */
|
|
function publishLoading(next) {
|
|
loading.value = next && markRaw(next);
|
|
}
|
|
|
|
/** @param {?object} next A fresh presentation of the road network chip. */
|
|
function publishTraffic(next) {
|
|
traffic.value = next && markRaw(next);
|
|
}
|
|
|
|
/** @param {?object} next A fresh presentation of the camera grid chip. */
|
|
function publishCctv(next) {
|
|
cctv.value = next && markRaw(next);
|
|
}
|
|
|
|
/** @param {?{text: string, visible: boolean, shown: number}} next */
|
|
function publishToast(next) {
|
|
toast.value = next && markRaw(next);
|
|
}
|
|
|
|
/** @param {?{visible: boolean, text: string}} next */
|
|
function publishFps(next) {
|
|
fps.value = next && markRaw(next);
|
|
}
|
|
|
|
/** @param {?object} next A fresh presentation of the render failure. */
|
|
function publishRenderFailure(next) {
|
|
renderFailure.value = next && markRaw(next);
|
|
}
|
|
|
|
return {
|
|
fps,
|
|
publishFps,
|
|
toast,
|
|
publishToast,
|
|
loading,
|
|
publishLoading,
|
|
traffic,
|
|
publishTraffic,
|
|
cctv,
|
|
publishCctv,
|
|
renderFailure,
|
|
publishRenderFailure,
|
|
};
|
|
});
|