mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-11 13:52:19 +00:00
feat(ui): render the FPS readout in the title bar from the status store
createFrameRateMonitor() keeps the key, frame count and interval and publishes the readout to the gev-status store; the scene chrome renders it after the subtitle with the same class, hidden state and title. A page without the title bar still gets no monitor, and a monitor only updates or withdraws the readout the store shows.
This commit is contained in:
1 parent
e0abf74308
commit
f9bf782b9c
8 files changed
+161
-48
No files matched your search
+15
-1
@@ -5,7 +5,8 @@ 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. Each label keeps its
|
||||
* 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.
|
||||
*/
|
||||
export const useStatusStore = defineStore('gev-status', () => {
|
||||
@@ -25,6 +26,12 @@ export const useStatusStore = defineStore('gev-status', () => {
|
||||
*/
|
||||
const toast = shallowRef(null);
|
||||
|
||||
/**
|
||||
* The title bar's FPS readout, `{visible, text}`; null while no monitor
|
||||
* counts frames.
|
||||
*/
|
||||
const fps = shallowRef(null);
|
||||
|
||||
/** @param {?object} next A fresh presentation of the loading status. */
|
||||
function publishLoading(next) {
|
||||
loading.value = next && markRaw(next);
|
||||
@@ -45,7 +52,14 @@ export const useStatusStore = defineStore('gev-status', () => {
|
||||
toast.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/** @param {?{visible: boolean, text: string}} next */
|
||||
function publishFps(next) {
|
||||
fps.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
return {
|
||||
fps,
|
||||
publishFps,
|
||||
toast,
|
||||
publishToast,
|
||||
loading,
|
||||
|
||||
Reference in new issue
Block a user