mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
fix(cctv): show a camera facing 359.6° as HDG 0°, not HDG 360°
The CCTV HUD heading token and the camera panel's meta line rounded the bearing without wrapping, so a camera facing 359.5° or more (a feed bearing, or a heading calibrated just west of north) read "HDG 360°". Both now wrap after rounding: 359.6° reads "HDG 0°", 359.4° "HDG 359°".
This commit is contained in:
1 parent
a4d3701c3c
commit
940050d4e5
5 files changed
+39
-3
No files matched your search
@@ -47,6 +47,30 @@ function fixture(t) {
|
||||
return { controls, requests };
|
||||
}
|
||||
|
||||
test('the panel meta line reads a bearing that rounds to north as HDG 0°', (t) => {
|
||||
const { controls } = fixture(t);
|
||||
controls.actions.setPanelCollapsed = () => {};
|
||||
controls._cctvMeta = element();
|
||||
const meta = (headingDeg) => {
|
||||
const camera = {
|
||||
id: 'a',
|
||||
city: 'Austin',
|
||||
headingDeg,
|
||||
fovDeg: 74,
|
||||
rangeM: 700,
|
||||
};
|
||||
controls._renderCctvState({
|
||||
enabled: true,
|
||||
activeCameraId: camera.id,
|
||||
activeCamera: camera,
|
||||
cameras: [camera],
|
||||
});
|
||||
return controls._cctvMeta.textContent;
|
||||
};
|
||||
assert.match(meta(359.4), /· HDG 359° ·/);
|
||||
assert.match(meta(359.6), /· HDG 0° ·/);
|
||||
});
|
||||
|
||||
test('a late image completion cannot replace a newer camera preview', (t) => {
|
||||
const { controls, requests } = fixture(t);
|
||||
controls._queueCctvFrame('first.jpg', 'a', true);
|
||||
|
||||
@@ -171,7 +171,7 @@ export function _renderCctvState(state) {
|
||||
'{city} · HDG {heading} · FOV {fov} · RANGE {range}m · {projection}{calBadge} · {provider}{status}',
|
||||
{
|
||||
city: activeCamera.city,
|
||||
heading: `${Math.round(activeCamera.headingDeg)}°`,
|
||||
heading: `${Math.round(activeCamera.headingDeg) % 360}°`,
|
||||
fov: `${Math.round(activeCamera.fovDeg)}°`,
|
||||
range: Math.round(activeCamera.rangeM),
|
||||
projection: projLabel,
|
||||
|
||||
Reference in new issue
Block a user