mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 18:22:25 +00:00
Review fixes: station panel and model housekeeping, label-box click, telemetry null stamp
- Installations: the label-box click fallback reaches the controls' methods (it read an undefined member and never ran). - Station model: the docked-companion scan runs once a second again; the hand-over pass runs once, when the model starts drawing. - Station panel: an unchanged view is not republished every frame; one render pump across slider drags, stopped on destroy; destroying the panel hands the joints back to Automatic, and the joint drivers' reset forgets manual choices and the telemetry lock. - Telemetry relay: a null TimeStamp is no time, not the first second of the year. - Drop issCommandShouldShow and issCommandNoteText, which nothing called.
This commit is contained in:
1 parent
ae9cfa4ffb
commit
aeaa192b5f
8 files changed
+63
-77
No files matched your search
@@ -64,6 +64,11 @@ export function createStationPanel({
|
||||
let sliders = new Map();
|
||||
let ticker = null;
|
||||
let zoomTimer = null;
|
||||
/** The frame pump while a joint glides, and when it stops. */
|
||||
let pump = null;
|
||||
let pumpUntil = 0;
|
||||
/** The last view published, as text: an unchanged view is not republished. */
|
||||
let publishedKey = null;
|
||||
|
||||
function _stationShown() {
|
||||
if (!layerState._enabled) return null;
|
||||
@@ -88,6 +93,7 @@ export function createStationPanel({
|
||||
if (!station) {
|
||||
if (view !== null) {
|
||||
view = null;
|
||||
publishedKey = null;
|
||||
for (const listener of listeners) listener(null);
|
||||
}
|
||||
return;
|
||||
@@ -98,7 +104,7 @@ export function createStationPanel({
|
||||
? (findCamera(layerState._viewer)?.pose?.()?.position ?? null)
|
||||
: null;
|
||||
const range = position && eye ? distance(eye, position) : null;
|
||||
view = {
|
||||
const next = {
|
||||
key: station.key,
|
||||
title: station.title,
|
||||
subject: station.subjectName(),
|
||||
@@ -143,6 +149,12 @@ export function createStationPanel({
|
||||
label: station.zoomLabel,
|
||||
},
|
||||
};
|
||||
// Called every frame from the tick: the section re-renders only on a
|
||||
// change (the age line moves once a second, the rest on an action).
|
||||
const key = JSON.stringify(next);
|
||||
if (key === publishedKey) return;
|
||||
publishedKey = key;
|
||||
view = next;
|
||||
for (const listener of listeners) listener(view);
|
||||
}
|
||||
|
||||
@@ -165,17 +177,27 @@ export function createStationPanel({
|
||||
findFrame(layerState._viewer)?.requestRender('station-panel');
|
||||
}
|
||||
|
||||
/** Keep frames coming while a joint glides to a new pose. */
|
||||
/**
|
||||
* Keep frames coming while a joint glides to a new pose: one pump, run
|
||||
* until the latest ask (a slider drag asks many times a second).
|
||||
*/
|
||||
function _renderFor(ms) {
|
||||
if (!findFrame(layerState._viewer)) return;
|
||||
const until = now() + ms;
|
||||
const pump = setInterval(() => {
|
||||
pumpUntil = Math.max(pumpUntil, now() + ms);
|
||||
if (pump) return;
|
||||
pump = setInterval(() => {
|
||||
_requestRender();
|
||||
if (now() > until) clearInterval(pump);
|
||||
if (now() > pumpUntil) _stopPump();
|
||||
}, 33);
|
||||
pump.unref?.();
|
||||
}
|
||||
|
||||
function _stopPump() {
|
||||
if (pump) clearInterval(pump);
|
||||
pump = null;
|
||||
pumpUntil = 0;
|
||||
}
|
||||
|
||||
function _stopZoom() {
|
||||
if (zoomTimer) clearInterval(zoomTimer);
|
||||
zoomTimer = null;
|
||||
@@ -307,7 +329,13 @@ export function createStationPanel({
|
||||
}
|
||||
|
||||
function _destroyStationPanel() {
|
||||
// The joints go back to Automatic with the panel, as on leaving a station.
|
||||
if (current && mode === 'manual') {
|
||||
const articulation = current.articulation();
|
||||
if (articulation) current.automatic(articulation);
|
||||
}
|
||||
_stopZoom();
|
||||
_stopPump();
|
||||
if (ticker) clearInterval(ticker);
|
||||
ticker = null;
|
||||
current = null;
|
||||
|
||||
Reference in new issue
Block a user