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:
manjunath22466 committed 2026-11-18 19:19:41 +05:30
1 parent fde5f95b45
commit 7312280817
33 files changed
+702 -76

No files matched your search

+86
View File
@@ -11,6 +11,7 @@ import {
import { BHOTE_KOSHI_FLOOD_PATH } from './bhoteKoshiFloodPath.js';
import * as Cesium from 'cesium';
import { setLocale } from '../i18n/index.js';
import { registerPickOwner, unregisterPickOwner } from './pickRegistry.js';
import { SceneDirector } from '../scenes/director.js';
import { createPlaybackClock } from '../director/clock.js';
import { createDefaultScenePacks } from '../scenes/packs/defaults.js';
@@ -1049,3 +1050,88 @@ test('Bhote Koshi locator layers draw sets of their own, and halos only as they
assert.equal(await second.disable(), true);
assert.equal(viewer._test.live().length, 0);
});
// The trigger record's callout is an actionable card: the layers under it
// stand aside for it, so a click on it opens its source, as its keyboard
// action does; anything else on top is left alone.
test('a click on the locator callout runs its action', async () => {
const viewer = viewerFixture();
let onClick = null;
let top = null;
const activated = [];
const layer = createBhoteKoshiLocatorLayer({
overlayHost: overlayHostFixture(),
requestRender() {},
...nonRunningAnimation(),
input: () => ({
onClick(callback) {
onClick = callback;
return () => {
onClick = null;
};
},
}),
hitTest: () => top,
});
await layer.init(viewer);
await layer.enable(viewer);
const click = (extra = {}) =>
onClick?.({
screenPosition: { x: 5, y: 5 },
gesture: { travelPx: 0, durationMs: 80 },
topHit: null,
hit: null,
...extra,
});
top = {
sourceId: BHOTE_KOSHI_LOCATOR_OVERLAY_SOURCE_ID,
entryId: 'bhote-koshi-trigger-record-callout',
entry: { activate: () => activated.push('trigger') },
};
click();
assert.deepEqual(activated, ['trigger']);
top = {
sourceId: 'earthquake-card',
entry: { activate: () => activated.push('other') },
};
click();
assert.deepEqual(activated, ['trigger'], 'another layer on top is its own');
// A drag that ends on it is not a click on it.
top = {
sourceId: BHOTE_KOSHI_LOCATOR_OVERLAY_SOURCE_ID,
entry: { activate: () => activated.push('trigger') },
};
click({ gesture: { travelPx: 30, durationMs: 80 } });
assert.deepEqual(activated, ['trigger'], 'a drag does not open it');
// An aircraft under it is that layer's click, exact or a touch contact.
registerPickOwner('test-planes', (id) => id === 'plane:1', {
expanded: true,
});
try {
const plane = { set: 'planes:1', id: 'plane:1' };
click({ topHit: plane, hit: plane });
click({ topHit: null, hit: plane });
assert.deepEqual(activated, ['trigger'], 'the aircraft takes it');
} finally {
unregisterPickOwner('test-planes');
}
// A layer that acts only on exact hits does not take a touch contact, and
// one that ignores this click (a long press on a camera) takes nothing: the
// callout keeps both.
registerPickOwner('test-cameras', (id) => id === 'cam:1', {
declinesClick: (event) => (event?.gesture?.durationMs ?? 0) > 400,
});
try {
const cam = { set: 'cams:1', id: 'cam:1' };
click({ topHit: null, hit: cam });
assert.equal(activated.length, 2, 'a near miss of an exact-only camera');
click({ topHit: cam, hit: cam, gesture: { travelPx: 0, durationMs: 900 } });
assert.equal(activated.length, 3, 'a long press the camera ignores');
click({ topHit: cam, hit: cam });
assert.equal(activated.length, 3, 'a clean click on the camera is its own');
} finally {
unregisterPickOwner('test-cameras');
}
await layer.disable();
assert.equal(onClick, null, 'disable removes the click handler');
});