mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Let every click subscriber hear a mission-label click
A click a painted overlay handled, such as a Space Missions label, returned before any click subscriber ran, so the layers that close their cards or let go of their selection on a click never heard it. Now only the picking the label replaces is skipped: subscribers still hear the click, marked as an overlay click whose hit is the label (no draw set, no id, nothing drilled), and the geometry beneath it is not picked. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
ee37511332
commit
9ac937af82
4 files changed
+109
-13
No files matched your search
@@ -7493,7 +7493,7 @@ silently demoting every later lookup for the session.
|
||||
protected-card path. Disable tears the tier down completely.
|
||||
Coverage/viewshed semantics unchanged.
|
||||
- **Satellites**: every point moves every frame. Each satellite's SGP4 sample (position, velocity, gravity and its rate of change; `src/layers/satellites/motion.js`) is reckoned forward or back to the world time and turned into the Earth-fixed frame, so points glide at any play speed instead of stepping once a second. Core satellites take a fresh sample every second, or as soon as the world time is 30 s from their sample (fast play, a seek), which keeps every point within about 10 m of SGP4; Starlink extras are sampled round-robin, more per frame the faster time plays, and a point more than two minutes from its sample waits for the next one. Hidden points are not moved until shown. Orbit rings rotate about Earth's Z by ΔGMST every ~1s (exact inertial→ECEF compensation; no SGP4 re-runs); the tracked satellite propagates per frame with one shared epoch for dot/label/camera. Verified: ISS holds <1km perpendicular to its ring while tracked. Pass prediction (`src/data/satellitePass.js`; `getNextSatellitePass`, `getNextIssPass`) scans at 20s, bisects rise/set to ~0.2s, fits the peak with a parabola, and marks a pass visible when the satellite is outside a cylindrical Earth shadow while the observer's Sun is at or below −6°. `next_iss_pass` preserves its geometric-pass ordering and appends visibility metadata. General `next_satellite_pass` accepts a loaded NORAD ID or unambiguous name, searches 24 hours and optionally requires estimated visibility. These estimates do not account for weather or satellite brightness.
|
||||
- **Space Missions (30d)**: recent launches render as bounded shared-host, horizon-occluded mission markers using Launch Library 2 v2.3 detailed records. Enabling the layer reveals its own right-rail button and roster and enables the required satellite layer; it does not touch Context. Before applying its temporary dense/hidden Satellite mode, Space Missions snapshots the complete standalone Satellite parameter set and exact enabled-layer set. Disabling Space Missions from Data Layers hides its rail button and panel and restores those parameters and the exact prior enabled state, so a Satellite layer that was already on stays on while a mode-owned dependency returns off; enabling Satellites by itself remains independent. An explicit user or voice Satellites OFF requested after Space Missions ON exits Space Missions, including after returning from Stories; scene, story, preset and other programmatic Satellites changes do not. The controls under the Space Missions row cycle through available launches. Selecting a mission isolates its launch-to-orbit transfer and dashed satellite orbit, fills the Space Missions panel with details, navigation, and replay controls, and animates a small phase-colored marker along the exact displayed Cartesian samples. Marker hit testing drill-picks through photorealistic tiles so the depth-test-free tactical dot remains reliably selectable. Clicking the launch name on the globe selects and focuses the same mission as its dot. The selected pad is the camera's zoom pivot: the overview remains centered on its launch site, wheel zoom approaches that site instead of drifting elsewhere, and camera pitch progressively changes from global nadir to an oblique close 3D view. Its protected shared-host callout remains visible and expands to include both mission and launch-site names. `FOCUS` flies directly to a 12 km oblique frame around the selected launch site and retains the same anchored zoom/orbit behavior. `REPLAY ASCENT` resets the selected marker at the pad, frames it from an oblique third-person angle, and follows it through the mission-specific compressed ascent directly into one orbital lap at the default `1×` rate. A live `0.25×`–`4×` slider changes ascent and orbit playback speed; adjusting it mid-replay preserves the current path position and historical mission timestamp. Re-entry/recovery cannot be inserted into replay. At orbit insertion the camera smoothly pulls back over the first fifth of the orbital replay and pitches to a globe-scale nadir view while continuing to target the moving replay point. Replay Cancel, mission navigation, deselection, layer disable, and data refresh all release camera ownership. Reconstructed paths are one continuous 128-sample geodetic curve: horizontal departure begins near zero while altitude rises quickly, then the climb progressively bends toward insertion without the former hard 120 km corner. Unmatched orbit fallbacks are smooth planar inclined rings rather than longitude/latitude ground-track curves. The panel lists disclosed payload names, types, operators/manufacturers, mass, multiplicity, and destination when supplied; an empty LL2 payload collection is shown as `CLASSIFIED / MULTI-PAYLOAD`. Launcher, spacecraft, and recoverable payload stages appear in a compact stage table with serial/flight/reuse details, recovery outcome/type, destination, and final coordinates when those records exist; an empty recovery collection omits the section. Stage recoveries with confirmed coordinates use those coordinates; return-to-launch-site records use the pad; downrange-only records receive an explicitly labeled estimated endpoint along the ascent azimuth. Available endpoints render as static 2 px dashed descent/recovery paths with a fixed final-position dot and an estimated atmospheric-interface segment when applicable. The ascent is geodetically densified above the ellipsoid toward the orbit's nearest insertion point, then rendered with `ArcType.NONE`, so it neither cuts through Earth nor separates from the marker. Because LL2 does not normally supply continuous ascent telemetry, pad-to-insertion paths without upstream trajectory samples are labeled `RECONSTRUCTED ESTIMATE` / `ASCENT ESTIMATE`; only supplied trajectory samples receive the replay wording. Selected-orbit framing fits the complete ring, rear-side linework uses normal scene depth occlusion, and current distance, speed, and callout data come only from a launch-year-validated satellite match. Both the loaded-catalog and active-TLE lookups read the launch year from the TLE international designator through one parser (`src/sources/tle.js`); a blank or malformed designator is an unknown year, which skips the year check rather than rejecting the match. Speed is the magnitude of the SGP4 inertial velocity vector at the same propagation epoch as position, displayed in km/s with km/h available as hover detail. Unavailable operator, site, launch-time, orbit, current-altitude, and speed valLine truncated
|
||||
- **Space Missions (30d)**: recent launches render as bounded shared-host, horizon-occluded mission markers using Launch Library 2 v2.3 detailed records. Enabling the layer reveals its own right-rail button and roster and enables the required satellite layer; it does not touch Context. Before applying its temporary dense/hidden Satellite mode, Space Missions snapshots the complete standalone Satellite parameter set and exact enabled-layer set. Disabling Space Missions from Data Layers hides its rail button and panel and restores those parameters and the exact prior enabled state, so a Satellite layer that was already on stays on while a mode-owned dependency returns off; enabling Satellites by itself remains independent. An explicit user or voice Satellites OFF requested after Space Missions ON exits Space Missions, including after returning from Stories; scene, story, preset and other programmatic Satellites changes do not. The controls under the Space Missions row cycle through available launches. Selecting a mission isolates its launch-to-orbit transfer and dashed satellite orbit, fills the Space Missions panel with details, navigation, and replay controls, and animates a small phase-colored marker along the exact displayed Cartesian samples. Marker hit testing drill-picks through photorealistic tiles so the depth-test-free tactical dot remains reliably selectable. Clicking the launch name on the globe selects and focuses the same mission as its dot; what is drawn beneath the name is not picked, and the other layers still hear the click as one on the name, so they close their cards or let go of their selection as for any other click. The selected pad is the camera's zoom pivot: the overview remains centered on its launch site, wheel zoom approaches that site instead of drifting elsewhere, and camera pitch progressively changes from global nadir to an oblique close 3D view. Its protected shared-host callout remains visible and expands to include both mission and launch-site names. `FOCUS` flies directly to a 12 km oblique frame around the selected launch site and retains the same anchored zoom/orbit behavior. `REPLAY ASCENT` resets the selected marker at the pad, frames it from an oblique third-person angle, and follows it through the mission-specific compressed ascent directly into one orbital lap at the default `1×` rate. A live `0.25×`–`4×` slider changes ascent and orbit playback speed; adjusting it mid-replay preserves the current path position and historical mission timestamp. Re-entry/recovery cannot be inserted into replay. At orbit insertion the camera smoothly pulls back over the first fifth of the orbital replay and pitches to a globe-scale nadir view while continuing to target the moving replay point. Replay Cancel, mission navigation, deselection, layer disable, and data refresh all release camera ownership. Reconstructed paths are one continuous 128-sample geodetic curve: horizontal departure begins near zero while altitude rises quickly, then the climb progressively bends toward insertion without the former hard 120 km corner. Unmatched orbit fallbacks are smooth planar inclined rings rather than longitude/latitude ground-track curves. The panel lists disclosed payload names, types, operators/manufacturers, mass, multiplicity, and destination when supplied; an empty LL2 payload collection is shown as `CLASSIFIED / MULTI-PAYLOAD`. Launcher, spacecraft, and recoverable payload stages appear in a compact stage table with serial/flight/reuse details, recovery outcome/type, destination, and final coordinates when those records exist; an empty recovery collection omits the section. Stage recoveries with confirmed coordinates use those coordinates; return-to-launch-site records use the pad; downrange-only records receive an explicitly labeled estimated endpoint along the ascent azimuth. Available endpoints render as static 2 px dashed descent/recovery paths with a fixed final-position dot and an estimated atmospheric-interface segment when applicable. The ascent is geodetically densified above the ellipsoid toward the orbit's nearest insertion point, then rendered with `ArcType.NONE`, so it neither cuts through Earth nor separates from the marker. Because LL2 does not normally supply continuous ascent telemetry, pad-to-insertion paths without upstream trajectory samples are labeled `RECONSTRUCTED ESTIMATE` / `ASCENT ESTIMATE`; only supplied trajectory samples receive the replay wording. Selected-orbit framing fits the complete ring, rear-side linework uses normal scene depth occlusion, and current distance, speed, and callout data come only from a launch-year-validated satellite match. Both the loaded-catalog and active-TLE lookups read the launch year from the TLE international designator through one parser (`src/sources/tle.js`); a blank or malformed designator is an unknown year, which skips the year check rather than rejecting the match. Speed is the magnitude of the SGP4 inertial velociLine truncated
|
||||
When no mission is selected, the Space Missions panel presents a scrollable newest-first roster of every launch in the rolling window, including the smaller 5 px operator-colored marker, provider, and launch date. Hovering or keyboard-focusing a row shows four compact cyan corner brackets on both that roster row and its corresponding globe dot, rotates the globe at the current zoom to center it, and gives its label declutter priority without selecting it; the globe label remains unbracketed. Selecting a roster row invokes the same mission isolation and full-orbit framing as clicking its globe marker. The replay vehicle is one screen-space SVG/CSS HUD overlay rather than separate Cesium billboard, label, and reticle graphics. It is hidden during ordinary Focus and manual close views, where the standard selected launch-site label remains visible, and exists only while ascent replay is active. Its fixed pixel scale is shared by ascent and insertion, so camera range never resizes the rocket on screen before the phase boundary. Generic Launch Library pad names are reduced to their identifying suffix, and replay timestamps use a cyan state title over unprefixed white UTC date/time values. `REPLAY ASCENT` holds the unframed cyan/white rocket at the pad for a real-time `T−10` countdown, transitions through `LIFTOFF`, and attaches six tapered cyan/white ellipse waves directly below it from liftoff through insertion to convey thrust without adding scene geometry. While replay is active, the single start button is replaced by compact Play, Pause, and Cancel icon controls. Pause freezes countdown or mission time, vehicle/stage positions, camera target, labels, and thrust-wave animation; Play resumes from that exact frame, and Cancel releases replay camera ownership. The rocket and thrust group rotates from the path's live screen-space tangent, so its nose follows the visible ascent curve while the adjacent text remains upright. The camera begins as a close oblique launch chase, then smoothly widens between roughly 120 and 420 km vehicle altitude into a higher oblique context view that keeps the moving rocket targeted while exposing the ascent bend and orbit connection. At insertion the rocket/thrust glyph is replaced by the fixed-size cyan orbit dot, which the camera follows through the existing globe-scale orbit pullback. The chase camera limits per-frame yaw changes across heading wraps so it cannot abruptly cross in front of the vehicle and make ascent read in reverse; the replay-speed slider affects mission playback but not countdown duration.
|
||||
Mission world text has no native `LabelGraphics`: overview launch markers publish at most 48 ambient candidates for a 24-winner budget, while selecting a mission clears that overview source and publishes its launch-site callout, stage re-entry annotations, live/estimated payload-position readout, and orbit annotation as protected selected-lane entries. The source retains the exact former strings and colors. Static anchors reuse the Cartesian values used to build their mission geometry; the moving payload entry reads the layer's per-frame live-position cache; catalog-backed orbit annotation positions are cached in the same one-second matrix update that realigns the orbit primitive. Keyhole edge fade, horizon culling, final collision placement, and UI exclusion are owned by the shared host. Deselect restores the bounded overview, and refresh, disable, and destroy replace or clear both mission sources.
|
||||
A selected mission renders its orbit as four repeating tactical sectors, each containing one prominent cyan dot followed by one hundred thin translucent dashes. The bright dots act as orbit anchors while the subdued dash field remains depth-tested against the globe and is shown only for the selected mission.
|
||||
|
||||
+37
-6
@@ -182,6 +182,9 @@ function topHitOf(hit, foreign) {
|
||||
* when the adapter has none.
|
||||
* @property {unknown} pick `native.pick`, for code still bound to the
|
||||
* engine's pick objects that reads it here.
|
||||
* @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.
|
||||
* @property {(width: number, height: number) => unknown} pickWindow
|
||||
* `native.pickWindow`, the same.
|
||||
*/
|
||||
@@ -192,7 +195,9 @@ function topHitOf(hit, foreign) {
|
||||
* Ambient click subscription. Returns its unsubscribe.
|
||||
* @property {(fn: (event: ClickEvent) => boolean) => () => void} onOverlayClick
|
||||
* Hit-test a painted overlay before ambient clicks. Return true after
|
||||
* handling its topmost target to stop delivery to the geometry beneath it.
|
||||
* handling its topmost target: the geometry beneath it is not picked, and
|
||||
* the click subscribers hear the click as one on that target (`overlay`
|
||||
* true, `topHit` a hit with no set and no id, nothing drilled).
|
||||
* @property {(type: 'down'|'move'|'up'|'click'|'dblclick', fn: Function, options?: {lease?: object|(() => object|null)}) => () => void} onPointer
|
||||
* Raw pointer subscription: `click` gets the {@link ClickEvent}, the others
|
||||
* `{position}` (`move`: `{startPosition, endPosition, pickPosition}`, its
|
||||
@@ -331,7 +336,7 @@ function createDispatcher(viewer, { query: givenQuery, ...portOptions } = {}) {
|
||||
click: (ev) => {
|
||||
if (!unmodifiedLeft(ev)) return;
|
||||
const ambient = free();
|
||||
const event = createClickEvent(
|
||||
const { event, cover } = createClickEvent(
|
||||
viewer,
|
||||
queryOf,
|
||||
xy(ev.position),
|
||||
@@ -340,7 +345,12 @@ function createDispatcher(viewer, { query: givenQuery, ...portOptions } = {}) {
|
||||
if (ambient) {
|
||||
for (const handle of [...overlayClicks]) {
|
||||
try {
|
||||
if (handle(event) === true) return;
|
||||
// A handled overlay target hides the geometry beneath it; every
|
||||
// subscriber still hears the click, as a click on that target.
|
||||
if (handle(event) === true) {
|
||||
cover();
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Pointer input handler failed', error);
|
||||
}
|
||||
@@ -437,6 +447,10 @@ function createDispatcher(viewer, { query: givenQuery, ...portOptions } = {}) {
|
||||
return self;
|
||||
}
|
||||
|
||||
/** What a click handled by a painted overlay target hits: that target,
|
||||
* drawn outside the draw port and named by no pick id. */
|
||||
const OVERLAY_HIT = Object.freeze({ set: '', id: null, surface: false });
|
||||
|
||||
/** A drill is run at least this deep and sliced, so callers asking for
|
||||
* different depths on one click share one pass. */
|
||||
const DRILL_DEPTH = 16;
|
||||
@@ -446,7 +460,8 @@ const DRILL_DEPTH = 16;
|
||||
* @param {() => import('../render/contract/query').QueryPort|null} queryOf
|
||||
* @param {{x: number, y: number}} at Where the click is, CSS pixels.
|
||||
* @param {ClickGesture} gesture
|
||||
* @returns {ClickEvent}
|
||||
* @returns {{event: ClickEvent, cover: () => void}} The click, and how a
|
||||
* handled overlay target hides the geometry beneath it from the click.
|
||||
*/
|
||||
function createClickEvent(viewer, queryOf, at, gesture) {
|
||||
const position = sensorPickPosition(viewer, at, canvasOf(viewer));
|
||||
@@ -465,11 +480,25 @@ function createClickEvent(viewer, queryOf, at, gesture) {
|
||||
};
|
||||
/** @type {Map<string, {limit: number, hits: Hit[]}>} */
|
||||
const drills = new Map();
|
||||
let covered = false;
|
||||
const cover = () => {
|
||||
covered = true;
|
||||
memo.clear();
|
||||
drills.clear();
|
||||
memo.set('top', OVERLAY_HIT);
|
||||
memo.set('hit', OVERLAY_HIT);
|
||||
memo.set('id', null);
|
||||
memo.set('ownerId', null);
|
||||
memo.set('native', null);
|
||||
};
|
||||
|
||||
return {
|
||||
const event = {
|
||||
screenPosition: at,
|
||||
position,
|
||||
gesture,
|
||||
get overlay() {
|
||||
return covered;
|
||||
},
|
||||
get topHit() {
|
||||
return once('top', () => {
|
||||
const hit = pick();
|
||||
@@ -515,6 +544,7 @@ function createClickEvent(viewer, queryOf, at, gesture) {
|
||||
return !this.hit;
|
||||
},
|
||||
windowHit(width, height) {
|
||||
if (covered) return { id: null, drawHit: null, surface: false };
|
||||
return once(`windowHit:${width}x${height}`, () => {
|
||||
const picked = pick({ width, height });
|
||||
void native()?.native.pickWindow(width, height);
|
||||
@@ -535,7 +565,7 @@ function createClickEvent(viewer, queryOf, at, gesture) {
|
||||
// A deeper pass already made holds these. (One that came back short
|
||||
// may not hold every hit: it drops what is not a draw-set item.)
|
||||
if (done && limit <= done.limit) return done.hits.slice(0, limit);
|
||||
const q = query();
|
||||
const q = covered ? null : query();
|
||||
if (!q) return [];
|
||||
// Only the default window is shared between layers; round that one up.
|
||||
const depth =
|
||||
@@ -568,4 +598,5 @@ function createClickEvent(viewer, queryOf, at, gesture) {
|
||||
return native()?.native.pickWindow(width, height);
|
||||
},
|
||||
};
|
||||
return { event, cover };
|
||||
}
|
||||
@@ -145,7 +145,8 @@ test('a painted overlay can claim a click before its underlying owner', (t) => {
|
||||
h.input.onPointer('click', () => clicks.push('ambient pointer'));
|
||||
|
||||
h.click();
|
||||
assert.deepEqual(clicks, ['mission label']);
|
||||
// The click still reaches every subscriber, as one on the label.
|
||||
assert.deepEqual(clicks, ['mission label', 'ambient pointer', null]);
|
||||
assert.equal(h.calls.pick, 0);
|
||||
|
||||
h.click(11, 10);
|
||||
@@ -154,12 +155,71 @@ test('a painted overlay can claim a click before its underlying owner', (t) => {
|
||||
assert.deepEqual(clicks, [
|
||||
'mission label',
|
||||
'ambient pointer',
|
||||
null,
|
||||
'ambient pointer',
|
||||
'satellites',
|
||||
'ambient pointer',
|
||||
'satellites',
|
||||
]);
|
||||
});
|
||||
|
||||
test('a click a painted overlay handles still reaches subscribers that clear selection', (t) => {
|
||||
const h = harness({
|
||||
pick: () => ({ set: 'flights', id: 'abc123' }),
|
||||
drillPick: () => [{ set: 'flights', id: 'abc123' }],
|
||||
});
|
||||
t.after(() => h.input.destroy());
|
||||
let seenByOverlay = null;
|
||||
h.input.onOverlayClick((event) => {
|
||||
seenByOverlay = event;
|
||||
return true;
|
||||
});
|
||||
const seen = [];
|
||||
h.input.onClick((event) => {
|
||||
seen.push({
|
||||
same: event === seenByOverlay,
|
||||
overlay: event.overlay,
|
||||
topHit: event.topHit,
|
||||
drawHit: event.drawHit,
|
||||
hit: event.hit,
|
||||
id: event.id,
|
||||
ownerId: event.ownerId,
|
||||
surface: event.surface,
|
||||
drill: event.drill(4),
|
||||
windowHit: event.windowHit(8, 8),
|
||||
pick: event.pick,
|
||||
});
|
||||
});
|
||||
h.click();
|
||||
assert.deepEqual(seen, [
|
||||
{
|
||||
same: true,
|
||||
overlay: true,
|
||||
topHit: { set: '', id: null, surface: false },
|
||||
drawHit: null,
|
||||
hit: { set: '', id: null, surface: false },
|
||||
id: null,
|
||||
ownerId: null,
|
||||
surface: false,
|
||||
drill: [],
|
||||
windowHit: { id: null, drawHit: null, surface: false },
|
||||
pick: undefined,
|
||||
},
|
||||
]);
|
||||
assert.equal(h.calls.pick, 0, 'the geometry beneath is not picked');
|
||||
assert.equal(h.calls.drillPick, 0);
|
||||
|
||||
// Without an overlay target the same click picks the geometry.
|
||||
seen.length = 0;
|
||||
h.input.destroy();
|
||||
const g = harness({ pick: () => ({ set: 'flights', id: 'abc123' }) });
|
||||
t.after(() => g.input.destroy());
|
||||
g.input.onClick((event) => seen.push([event.overlay, event.topHit]));
|
||||
g.click();
|
||||
assert.equal(seen[0][0], false);
|
||||
assert.equal(g.calls.pick, 1);
|
||||
});
|
||||
|
||||
test('the gesture carries summed travel and press time', (t) => {
|
||||
const h = harness();
|
||||
t.after(() => h.input.destroy());
|
||||
|
||||
@@ -118,11 +118,15 @@ const label = (
|
||||
entryId,
|
||||
});
|
||||
|
||||
test('a mission label click focuses its launch and stops the click there', (t) => {
|
||||
const r = rig(t, { overlayHit: label('launch:L2') });
|
||||
test('a mission label click focuses its launch and covers the geometry beneath', (t) => {
|
||||
const r = rig(t, { overlayHit: label('launch:L2'), geometryLaunchId: 'L1' });
|
||||
r.click();
|
||||
assert.deepEqual(r.focused, ['L2']);
|
||||
assert.equal(r.ambient.length, 0, 'the layers beneath do not see it');
|
||||
assert.deepEqual(r.focused, ['L2'], 'the mission beneath is not picked');
|
||||
// Other layers still hear it, to close their cards or clear selection,
|
||||
// as a click on the label rather than on the geometry beneath.
|
||||
assert.equal(r.ambient.length, 1);
|
||||
assert.equal(r.ambient[0].overlay, true);
|
||||
assert.equal(r.ambient[0].drawHit, null);
|
||||
|
||||
r.setHit(label('launch:L1', ROCKET_MISSION_SELECTED_OVERLAY_SOURCE_ID));
|
||||
r.click();
|
||||
@@ -156,7 +160,8 @@ test('a throwing globe-pick listener does not stop the pick', (t) => {
|
||||
r.click();
|
||||
assert.deepEqual(r.focused, ['L1']);
|
||||
assert.deepEqual(heard, ['L1']);
|
||||
assert.equal(r.ambient.length, 0);
|
||||
assert.equal(r.ambient.length, 1);
|
||||
assert.equal(r.ambient[0].overlay, true);
|
||||
});
|
||||
|
||||
test('a mission label for an unknown launch falls through to other layers', (t) => {
|
||||
|
||||
Reference in new issue
Block a user