mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(earthquakes): address review follow-ups on click arbitration
A drifting touch tap or a cockpit-mode tap on a fire, quake or vessel card
beside an aircraft did nothing: the cards deferred to the aircraft, whose
click handler ignores such taps. Pick owners can now declare the clicks
they ignore (registerPickOwner(..., { declinesClick })); flights and
military decline a drag or a cockpit tap and CCTV declines any click that
is not clean, so a card over them keeps that tap.
Also from review:
- the selected quake's contour rings sit on the ground the disc is draped
on, re-read through the heights service while they paint;
- a label's fly-to frames the whole disc for large quakes;
- a quake that ages out of the feed clears its selection as evicted;
- id-less quakes are named by their content, not their row;
- the Bhote Koshi trigger-record callout opens its source on a click, as
its keyboard action does, and yields like the other cards;
- the card's place line is cut to 48 characters, its link hint shows only
with an opener, and its accessible name carries depth, place and time; a
link-less card's click and keyboard action fly to the quake;
- camera trace comparison scales its tolerance with the value and wraps
heading and roll.
This commit is contained in:
1 parent
fde5f95b45
commit
7312280817
33 files changed
+702
-76
No files matched your search
@@ -2,7 +2,7 @@ import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { recordCameraGoldens } from './cameraGoldens.js';
|
||||
import { near } from '../conformance/expect.js';
|
||||
import { near, nearAngle } from '../conformance/expect.js';
|
||||
|
||||
// The recorder is deterministic, but platforms can differ in the last bits
|
||||
// of trigonometric arithmetic. Keep structure and discrete values exact.
|
||||
@@ -18,7 +18,16 @@ function compareTrace(actual, expected, path = []) {
|
||||
path.at(-2) === 'position' ||
|
||||
key === 'height' ||
|
||||
(path.at(-2) === 'view' && Number(key) >= 12 && Number(key) <= 14);
|
||||
near(actual, expected, metres ? 1e-8 : 1e-14, label);
|
||||
// A few ulps of the value itself, so large untagged values (pick points,
|
||||
// ray origins, the far plane) are not held below one ulp.
|
||||
const tolerance = Math.max(
|
||||
metres ? 1e-8 : 1e-14,
|
||||
Math.abs(expected) * 4 * Number.EPSILON,
|
||||
);
|
||||
// Heading and roll wrap at 2π: a value just under it is one just over 0.
|
||||
if (key === 'heading' || key === 'roll')
|
||||
nearAngle(actual, expected, tolerance, label);
|
||||
else near(actual, expected, tolerance, label);
|
||||
return;
|
||||
}
|
||||
if (expected !== null && typeof expected === 'object') {
|
||||
@@ -71,3 +80,15 @@ test('trace comparison tolerates only numeric roundoff, preserving structure and
|
||||
const { label, ...missing } = expected;
|
||||
assert.throws(() => compareTrace(missing, expected));
|
||||
});
|
||||
|
||||
test('trace comparison scales with the value and wraps heading and roll', () => {
|
||||
// One ulp of a ground pick point (about 5e-10 at 3e6 m) is roundoff.
|
||||
const far = 3_000_000.123;
|
||||
compareTrace({ pick: far + 2 * Number.EPSILON * far }, { pick: far });
|
||||
assert.throws(() => compareTrace({ pick: far + 1e-6 }, { pick: far }));
|
||||
// A heading just under 2π is one just over 0.
|
||||
compareTrace({ heading: 2 * Math.PI - 1e-16 }, { heading: 1e-16 });
|
||||
compareTrace({ roll: 1e-16 }, { roll: 2 * Math.PI - 1e-16 });
|
||||
assert.throws(() => compareTrace({ heading: 0.1 }, { heading: 0 }));
|
||||
assert.throws(() => compareTrace({ heading: NaN }, { heading: 0 }));
|
||||
});
|
||||
Reference in new issue
Block a user