mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Merge origin/main into space-missions-fixes
Main's single click rule (the card or label on top takes the click, read once per click through clickCard and isUnderOtherCard in src/data/pickRegistry.js) covers a click on a Space Missions label: a mission marker label is an interactive world-overlay entry, so the host's hit test names it as the card on top for every other layer. The per-layer label guards in CCTV, Drone Airspace, FIRMS, Ghost Maps, News, Perimeters, Shipwrecks, Vessels, Wildlife Sightings, ALPR, Local ADS-B and the cockpit orbital focus are dropped for main's versions. The mission-label tests are kept on main's API: fakeInputUnderLabel now also names the label as the card on top, and each test shows a click on the label never acts on the card, camera, vessel, fire, reader, aircraft or report under it, and leaves the selection as it is. A launches test checks that a mission label is interactive and is the card on top for every other layer. Docs, changelog and the dispatcher's `overlay` note describe the merged behaviour. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
commit
0e5c5e624c
146 files changed
+9734
-1157
No files matched your search
@@ -185,8 +185,9 @@ function topHitOf(hit, foreign) {
|
||||
* @property {boolean} overlay Whether a painted overlay target took the
|
||||
* click ({@link InputDispatcher.onOverlayClick}). Its hits then name only
|
||||
* that target: something drawn outside the draw port, with no id. A
|
||||
* subscriber with its own hit test (painted cards, a pick of its own)
|
||||
* skips it then: what lies under the target is not clicked.
|
||||
* target the world overlay paints (a Space Missions label) is also the
|
||||
* card on top for every handler (`clickCard` in src/data/pickRegistry.js),
|
||||
* so nothing under it acts.
|
||||
* @property {(width: number, height: number) => unknown} pickWindow
|
||||
* `native.pickWindow`, the same.
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,8 @@ import { rendererOf } from '../render/rendererOf.js';
|
||||
import { fakeScenePicks } from '../testSupport/fakeCesiumScene.mjs';
|
||||
import { provideStyleStageAlias } from '../styles/styleStages.js';
|
||||
import { inputFor } from './dispatcher.js';
|
||||
import { setClickCardHitTest } from '../data/pickRegistry.js';
|
||||
import { ROCKET_MISSION_AMBIENT_OVERLAY_SOURCE_ID } from '../layers/launches/policy.js';
|
||||
|
||||
/** Cesium's own event types, the ones the input port binds. */
|
||||
export const FAKE_EVENT_TYPES = Cesium.ScreenSpaceEventType;
|
||||
@@ -141,17 +143,39 @@ export function fakeInput(viewer, { now } = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/** The Space Missions label {@link fakeInputUnderLabel} paints: an
|
||||
* interactive entry of the missions' world-overlay source. */
|
||||
export const MISSION_LABEL = Object.freeze({
|
||||
sourceId: ROCKET_MISSION_AMBIENT_OVERLAY_SOURCE_ID,
|
||||
entryId: 'launch:L1',
|
||||
});
|
||||
|
||||
/**
|
||||
* `fakeInput` with a label painted over the map, as a Space Missions label
|
||||
* is: while `label.over` is true the label takes each click, so every click
|
||||
* subscriber hears it as an overlay click (`event.overlay`), and the
|
||||
* geometry beneath it is not picked.
|
||||
* `fakeInput` with a Space Missions label painted over the map: while
|
||||
* `label.over` is true the label takes each click, so every click subscriber
|
||||
* hears it as an overlay click (`event.overlay`) and the geometry beneath it
|
||||
* is not picked, and the pick registry names it as the card on top
|
||||
* (`clickCard`), as the world-overlay host's hit test names an interactive
|
||||
* mission label. `destroy` also clears that hit test.
|
||||
* @param {object} viewer
|
||||
* @param {{now?: () => number}} [options]
|
||||
* @param {{now?: () => number, beneath?: () => ({sourceId: string, entryId: string}|null)}} [options]
|
||||
* `beneath`: the card painted under the label, on top when the label is
|
||||
* not over the click.
|
||||
*/
|
||||
export function fakeInputUnderLabel(viewer, options) {
|
||||
export function fakeInputUnderLabel(
|
||||
viewer,
|
||||
{ beneath = () => null, ...options } = {},
|
||||
) {
|
||||
const fake = fakeInput(viewer, options);
|
||||
const label = { over: false };
|
||||
fake.input.onOverlayClick(() => label.over);
|
||||
return { ...fake, label };
|
||||
setClickCardHitTest(() => (label.over ? MISSION_LABEL : beneath()));
|
||||
return {
|
||||
...fake,
|
||||
label,
|
||||
destroy() {
|
||||
setClickCardHitTest(null);
|
||||
fake.destroy();
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user