mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge main through #1591 into the renderer seam
Brings in the wildlife sightings layer (#1591, iNaturalist and Acartia sightings). Its badges, density glow and privacy cells draw through the draw port: the badges and the glow are icons sets (iconCollection.js batches point writes into one upsert per task), and the privacy cells are ground-clamped shapes and lines sets swapped whole. The eye, the view rectangle, clicks, projection, ground readiness and frames come from the camera, query, input, globe and frame ports, so the layer, its card and its placement no longer import Cesium. Differences from main: the density glow is drawn as pixel-sized splats (56 px) instead of metre-sized ones with a near fade; the card's pan eases with cubicOut, the contract's nearest ease-out; ground heights are resampled when the globe's load progress settles or its surface changes, rather than on tileset load events. Also fixes two things the last merge left: a double-click that starts on the followed track and ends off it reaches the renderer's own follow again (a press that cannot end a double-click on the track gives its hold back at its release), and the Active Fires heat drapes under the weather imagery, so weather turned on after it stacks above. CURRENT-STATE notes that the 2D and Columbus scene-mode checks are gone.
This commit is contained in:
commit
020a433b51
129 files changed
+22143
-336
No files matched your search
+36
-5
@@ -62,9 +62,15 @@ export function onSceneDoubleClick(position) {
|
||||
const holdStockFollow = (viewer) =>
|
||||
findInput(viewer)?.behaviours?.dblclickFollow?.suppress?.() ?? null;
|
||||
|
||||
/** How long a press on the followed track keeps the stock follow off. */
|
||||
/**
|
||||
* How long a press on the followed track keeps the stock follow off, and
|
||||
* how soon after a press the next one may end a double-click with it.
|
||||
*/
|
||||
const SUBJECT_PRESS_HOLD_MS = 700;
|
||||
|
||||
/** How far apart, CSS pixels, two presses of one double-click may land. */
|
||||
const DOUBLE_CLICK_SLOP_PX = 8;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -74,7 +80,12 @@ const SUBJECT_PRESS_HOLD_MS = 700;
|
||||
* 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
|
||||
* else is the renderer's, as before. The renderer decides a double-click's
|
||||
* stock follow from its second press, as the hold stood when that press
|
||||
* went down, so a press that cannot end a double-click on the track (no
|
||||
* press on the track came just before it, at about the same spot) gives
|
||||
* its hold back at its release: a second press off the track then finds
|
||||
* the follow free. `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.
|
||||
*/
|
||||
@@ -89,29 +100,49 @@ export function routeSceneDoubleClick() {
|
||||
}
|
||||
let release = null;
|
||||
let timer = null;
|
||||
// The last left press (when, where, and whether it was on the track),
|
||||
// and whether the held press could end a double-click on the track.
|
||||
let last = null;
|
||||
let endsDouble = false;
|
||||
const drop = () => {
|
||||
globalThis.clearTimeout(timer);
|
||||
timer = null;
|
||||
release?.();
|
||||
release = null;
|
||||
};
|
||||
// Ambient `down`/`up` are the unmodified left button's, while the
|
||||
// pointer is free.
|
||||
const offDown = input.onPointer('down', ({ position }) => {
|
||||
drop();
|
||||
if (this.active || this.destroyed || !isPointerFree()) return;
|
||||
if (!doubleClickHitsSubject(position, subjectCanvasPosition.call(this)))
|
||||
return;
|
||||
const at = Date.now();
|
||||
const onSubject =
|
||||
!this.active &&
|
||||
!this.destroyed &&
|
||||
isPointerFree() &&
|
||||
doubleClickHitsSubject(position, subjectCanvasPosition.call(this));
|
||||
endsDouble =
|
||||
!!last?.onSubject &&
|
||||
at - last.at <= SUBJECT_PRESS_HOLD_MS &&
|
||||
Math.hypot(position?.x - last.x, position?.y - last.y) <=
|
||||
DOUBLE_CLICK_SLOP_PX;
|
||||
last = { at, x: position?.x, y: position?.y, onSubject };
|
||||
if (!onSubject) 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 offUp = input.onPointer('up', () => {
|
||||
if (!endsDouble) drop();
|
||||
});
|
||||
const offDouble = input.onPointer('dblclick', ({ position }) => {
|
||||
this.onSceneDoubleClick(position);
|
||||
drop();
|
||||
});
|
||||
return () => {
|
||||
offDown();
|
||||
offUp();
|
||||
offDouble();
|
||||
drop();
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user