Merge main through #1556 into the renderer seam

Brings in fire intensity and the draped heatmap (#1426), provider labels
(#1521), Rio transit (#1481), chat autocomplete and provider switching
(#1561, #1546) and Cockpit entry by the ridden layer alone (#1556).

What main added that reached Cesium or the viewer:
- The fires heatmap drapes as one image through the globe port's imagery
  (heatImagery.js), above the port's other imagery, and drapes again when
  the map stack's surface changes. The far bands no longer draw heat
  rectangles; the layer's shape set stays as its initialized marker and
  the visibility the context store reads.
- The hand-off between heatmap and markers fades the glow icons' own
  alpha and the icon set's visibility. Markers keep their glows across
  rebuilds; the set culls the horizon itself.
- A double-click on the followed track enters the Cockpit through the
  input dispatcher. The renderer's own double-click follow would let go
  of the track first and cannot be refused from a subscriber, so a press
  on the followed track holds that behaviour off for the press.
- Cockpit entry and the ridden layer read the follow service; the camera
  takes its eye offsets from a profile.
This commit is contained in:
Sameh Khamis committed 2026-11-09 20:52:52 -08:00
commit 823b5dc301
119 files changed
+5782 -577

No files matched your search

+120
View File
@@ -1,6 +1,126 @@
/** Route Cockpit keys while preserving the active disclosure and form-control owner. */
import { followedOf } from '../data/followed.js';
import { isPointerFree } from '../data/inputOwnership.js';
import { inputFor } from '../input/dispatcher.js';
import { findInput, findQuery } from '../render/rendererOf.js';
import { trackedPositionNow } from './cockpitCamera.js';
/** How far from the followed track a double-click may land, CSS pixels. */
export const SUBJECT_DOUBLE_CLICK_RADIUS_PX = 32;
/**
* Whether a double-click landed on the followed track's mark.
* @param {{x: number, y: number}|null} click Canvas position of the click.
* @param {{x: number, y: number}|null|undefined} subject Canvas position of
* the track, or nothing when it is off screen.
* @param {number} [radiusPx]
*/
export function doubleClickHitsSubject(
click,
subject,
radiusPx = SUBJECT_DOUBLE_CLICK_RADIUS_PX,
) {
if (!click || !subject) return false;
const distance = Math.hypot(click.x - subject.x, click.y - subject.y);
return Number.isFinite(distance) && distance <= radiusPx;
}
/** Where the track `kind` would ride is drawn now, as a world position. */
function subjectWorldPosition(kind) {
if (kind !== 'aircraft') return null;
return trackedPositionNow(this.viewer, followedOf(this.viewer));
}
/** The followed track's canvas position now, or null off screen. */
function subjectCanvasPosition() {
const kind = this.resolveEntryKind();
const world = kind ? subjectWorldPosition.call(this, kind) : null;
if (!world) return null;
return findQuery(this.viewer)?.project(world) ?? null;
}
/**
* Enter first person when the followed track itself is double-clicked: the
* same entry, and the same gates, as C and the entry buttons. A
* double-click anywhere else, or one a tool owns (drawing ends a shape with
* one), is left alone.
* @param {{x: number, y: number}|null|undefined} position Canvas position.
* @returns {boolean} True when it landed on the followed track, entered or
* refused by the gate: the caller does nothing else with it.
*/
export function onSceneDoubleClick(position) {
if (this.active || this.destroyed || !isPointerFree()) return false;
if (!Number.isFinite(position?.x) || !Number.isFinite(position?.y))
return false;
if (!doubleClickHitsSubject(position, subjectCanvasPosition.call(this)))
return false;
this.enter();
return true;
}
/** Hold the renderer's own double-click follow off; returns the release. */
const holdStockFollow = (viewer) =>
findInput(viewer)?.behaviours?.dblclickFollow?.suppress?.() ?? null;
/** How long a press on the followed track keeps the stock follow off. */
const SUBJECT_PRESS_HOLD_MS = 700;
/**
* Take the scene's double-click on the followed track for the Cockpit. The
* renderer's own double-click follow lets go of whatever is followed when
* the double-click does not land on something it can follow itself: on a
* followed aircraft's model it would drop the very track the double-click
* means to ride. It runs before any subscriber and cannot be refused from
* one, so a press on the followed track holds it off for that press
* (`behaviours.dblclickFollow`, a hold a `down` subscriber takes covers its
* press), and the double-click it ends in enters. A double-click anywhere
* else is the renderer's, as before. `this.holdStockFollow`, when set, takes
* the hold in place of the renderer's input port (tests).
* @returns {() => void} Stops listening and lets any hold go.
*/
export function routeSceneDoubleClick() {
let input;
try {
input = inputFor(this.viewer);
} catch {
// A viewer with no input to take (headless tools, partial stubs) has no
// double-click to route.
return () => {};
}
let release = null;
let timer = null;
const drop = () => {
globalThis.clearTimeout(timer);
timer = null;
release?.();
release = null;
};
const offDown = input.onPointer('down', ({ position }) => {
drop();
if (this.active || this.destroyed || !isPointerFree()) return;
if (!doubleClickHitsSubject(position, subjectCanvasPosition.call(this)))
return;
release = this.holdStockFollow
? this.holdStockFollow()
: holdStockFollow(this.viewer);
// A press that ends in no double-click gives the follow back by itself.
timer = globalThis.setTimeout(drop, SUBJECT_PRESS_HOLD_MS);
});
const offDouble = input.onPointer('dblclick', ({ position }) => {
this.onSceneDoubleClick(position);
drop();
});
return () => {
offDown();
offDouble();
drop();
};
}
/**
* The Cockpit's capture-phase keydown: Escape and C.
* @param {KeyboardEvent} event
*/
export function onKeyDown(event) {
if (this.destroyed) return false;
if (event.repeat || event.isComposing) return;