diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d1bbca687..412bf5da8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -111,6 +111,11 @@ jobs:
mkdir -p qa-artifacts
npm run qa:stub-boot -- --json qa-artifacts/stub-boot.json
+ - name: The renderer contract's logic checks on Cesium, headless
+ run: |
+ mkdir -p qa-artifacts
+ npm run qa:conformance -- --json qa-artifacts/conformance.json
+
- name: Preview server log
if: failure()
run: cat preview.log
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1edd67b7..666b5b997 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -58,11 +58,12 @@
models line up with their gates (samehkhamis).
- A renderer can draw weather: the `weather` capability adds `globe.weather`,
with clouds, fog, haze, rain and snow (each 0 to 1) and the wind they drift
- on. Where the renderer lists it, the view shows the conditions observed
- under the camera, asked again after five minutes or 25 km of movement, and
- the Display panel's Weather group can turn live weather off and set
- clouds, fog, rain and snow by hand. The Cesium renderer does not draw
- weather, and shows no Weather group (samehkhamis).
+ on. `./render/weather` and `./weather/effects` export the shared rules and
+ the strengths of a weather observation. The Cesium renderer does not draw
+ weather (samehkhamis).
+- An application can add its own groups of toggles, sliders and notes to the
+ Display panel under Effects, with `publishDisplayGroup` from
+ `./ui/display/groups` (samehkhamis).
- The globe opens at planet level, the whole Earth in view, on every
renderer, instead of flying in to Austin. A shared link still flies from
there to its view. An application can start somewhere else, a city for
diff --git a/dev/conformance/main.js b/dev/conformance/main.js
index 9c3586703..a1fb6c48a 100644
--- a/dev/conformance/main.js
+++ b/dev/conformance/main.js
@@ -53,11 +53,17 @@ const HARNESSES = {
],
};
-/** Runs the logic suite on `which`; `all` runs every check, listed or not. */
-async function runLogic(which = 'stub', { all = false } = {}) {
+/**
+ * Runs the logic suite on `which`; `all` runs every check, listed or not;
+ * `only` (check ids) runs just those of them.
+ */
+async function runLogic(which = 'stub', { all = false, only } = {}) {
status(`running the logic suite on ${which}…`);
const [harness, options] = HARNESSES[which]();
- const report = await runConformance(harness, all ? {} : options);
+ const listed = all ? () => true : (options.only ?? (() => true));
+ const report = await runConformance(harness, {
+ only: (id) => listed(id) && (!only || only.includes(id)),
+ });
$('logicResults').innerHTML =
`
${report.results
@@ -73,6 +79,7 @@ async function runLogic(which = 'stub', { all = false } = {}) {
failed: report.failed,
skipped: report.skipped,
failures: report.results.filter((r) => r.status === 'fail'),
+ skips: report.results.filter((r) => r.status === 'skip'),
};
}
diff --git a/docs/APPLICATION.md b/docs/APPLICATION.md
index a8e24fd6e..fa566e72b 100644
--- a/docs/APPLICATION.md
+++ b/docs/APPLICATION.md
@@ -133,10 +133,12 @@ factories loaded (`gods-eye-view/render/cesium/unbound`), or `inputFor` throws.
`onPointer(type, fn, { lease })` subscribes to `down`, `move`, `up`, `click`
or `dblclick`; with a lease it runs only while that lease is current. A tool
-takes its lease with `claimPointer(ownerId)` from the same export (and gives
-it back with `releasePointer(lease)`), which also keeps every ambient
-subscriber off its clicks; `isPointerFree()` and `pointerOwner()` report who
-holds it. `suspendCamera(reason)` and `suppressStockClicks()` return their
+takes its lease with `claimPointer(ownerId, { onLost })` from the same export
+(and gives it back with `releasePointer(lease)`), which also keeps every
+ambient subscriber off its clicks; `isPointerFree()` and `pointerOwner()`
+report who holds it. The newest claim takes over, as on the renderer's input
+port: the tool holding the pointer has its `onLost` called once and turns
+itself off, and its late release frees nothing. `suspendCamera(reason)` and `suppressStockClicks()` return their
own release: camera input and the viewer's stock select and double-click-track
come back when the last hold is released, so two holders cannot undo each
other. The renderer's input port owns the camera controller's `enableInputs`: a direct
diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md
index 93c7152ed..dcd435e58 100644
--- a/docs/CURRENT-STATE.md
+++ b/docs/CURRENT-STATE.md
@@ -4766,18 +4766,22 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with
> it, and narrow screens retain Cesium's surface with an internal
> scroller. The title, close control, links, and persistent Google/Cesium line
> remain unchanged and visible.
-> - **Distant-aircraft recession:** both civilian and military billboard fleets
+> - **Distant-aircraft recession:** both civilian and military icon sets
> retain their locked class/ground scale and `NearFarScalar`, then multiply a
-> limb-relative taper in the existing ~12 Hz tick. The taper is 1 below 0.5×
+> limb-relative taper. The sets say so themselves (`SetSpec.recede`, with
+> the tuning as its parameters, sent again when the tuning changes), and the
+> renderer works the taper out each frame from `render/recession`. The
+> taper is 1 below 0.5×
> geometric limb distance and smoothsteps to 0.45 scale plus a 0.35 alpha-haze
> factor at the limb. That treatment eases continuously back to identity from
> 3,500–4,500 km camera height, avoiding a globe-view threshold pop. These
> values, the start ratio, blend band, composed floor, and write epsilon remain
> runtime tunings. No aircraft is count-culled or made fully transparent.
-> Focus emphasis and limb haze multiply at one deadband-gated write site, and
-> their product is clamped to 0.20 before freshness alpha is applied. Ambient
-> fleet models receive that same composed alpha; class/ground/cockpit repaints
-> preserve the current limb scale instead of dropping it for a tick.
+> Focus emphasis and limb haze multiply, and their product is clamped to
+> 0.20 before freshness alpha is applied. Ambient fleet models receive that
+> same composed alpha, worked out on each fleet tick from the camera then
+> and written again once it moves by more than 0.005; their set itself does
+> not recede. Under the IR boost they draw at full alpha.
> - **Focus-aware contact de-emphasis:** civilian/military aircraft and
> satellites publish the selected target's padded screen bounds and camera
> distance from the same per-frame position cache already consumed by their
@@ -6118,8 +6122,9 @@ checks the claim once per click, before any subscriber runs, but DOM canvas
listeners (the evidence cards) still see the same browser event afterwards, so
a claim dropped the instant the endpoint is placed would hand them that click.
It is returned on the next tick after placement, and immediately on cancel, Escape, CLEAR, disable
-and destroy; if another tool already holds it nothing is armed and the row says
-so. Maneuver-dot selection is an ordinary ambient handler and yields while any
+and destroy. The newest claim takes over: arming takes the pointer from a tool
+holding it, which is told and turns itself off, and a newer tool taking it
+disarms the layer as Escape would. Maneuver-dot selection is an ordinary ambient handler and yields while any
tool holds the pointer. FLY runs through the UI shell's immediate-navigation
facade — the same camera authority validated voice destinations use — and is
handed the shared ground-floor read and corridor warm, so the dolly does not
@@ -7685,7 +7690,7 @@ request viewbox and continues searching without that geographic preference.
- UTILITIES ▸ **Draw** turns the globe into a whiteboard drawn by hand. Pick a shape (icon buttons for Area, Line and Pin) and a colour swatch for the next shape, click the vertices on the real world, and finish. **Keyboard contract, live only while Draw is on and never while you are typing in another field:** Enter finishes the shape (as does a double-click, and the two cannot both submit it — the session is replaced before the annotate call is awaited); Backspace removes the last vertex; Esc cancels the shape in progress, and a second Esc — Esc on an empty session — leaves draw mode. **Clear** wipes the board (the shape in progress and every placed mark), so removing marks does not require the console or the microphone.
- **Drawn shapes are listed under Draw like Import's files** (`src/ui/views/panels/DrawMarkList.vue`, rows worded by `presentDrawMarks` in `src/annotations/drawMarks.js`): one row per hand-drawn mark (`manual: true`; voice marks are not listed) with its colour swatch, its name, and show/hide, fly-to and remove. The draw tool publishes the rows with the rest of its controls and answers the row actions (`renameDrawMark`, `recolorDrawMark`, `toggleDrawMark`, `flyToDrawMark`, `removeDrawMark`) through the display store; it republishes on the engine's `onChange`, so a voice clear or an expiry updates the list. Rows are keyed and updated in place: a board change never takes a name being typed (the field keeps its draft while focused) or the button under a click. The name is saved on Enter or on leaving the field, once; Esc restores it, before anything else and with the row's colours open too. Both keep focus in the field, so neither drops it to the page or leaves Draw. The swatch opens the five colours right after it (shown at the end of the row), with the current colour focused; the arrows, Home and End try another, and a click or Esc closes them and returns focus to the swatch. Both colour groups (the next shape's and a row's) are one `DrawSwatches` radio group with a single tab stop, coloured from `DRAW_COLOR_CSS`; on touch screens each dot answers a 24 px target. An unnamed shape shows its kind, and an unnamed line its length; a renamed line keeps its length (`Ridge walk — 950 m`). **Hidden** keeps a mark on the board at alpha 0, and the world renderer takes every one of its entities out (`show = false`), so no material that keeps its own colour (the line's flowing stroke) still paints it; the screen renderer does not project a hidden callout, so it cannot push a visible label aside; `fly_route` skips a hidden route; and with every mark hidden the annotations render hold is released. **Fly to** is an immediate navigation (`runImmediateNavigation('drawing', …)`), like Import's: Cockpit refuses it and a running orbit, follow or track lets go first. A line is framed by its whole path, across the antimeridian too.
- Runtime entry: `createApplicationTools` (`src/app/tools.js`, behind the `src/standalone/tools.js` shim) calls `initDrawTool({ viewer, annotations, navigation, publish, connect, markActions })` after `initAnnotations` and defers its `destroy()`, so disposing the shell returns every DOM listener, the pointer subscriptions, the preview draw sets, the borrowed click actions and the `window.__gevDrawTool` handle. The live preview (a dashed rubber band, dashed behind the surface too through the line's `depthFail` style, and a dot per vertex) is two sets on the renderer's draw port, so the tool no longer reaches Cesium; the rubber band follows each move's `pickPosition`, the dispatcher's sensor-corrected pick-buffer point, as clicks do. Its controls are Vue views in the UTILITIES panel (`DrawControls.vue`, `DrawMarkList.vue`) that render what the tool publishes to the display store and call its actions. That handle (`setActive`, `setShape`, `addVertex(lon, lat)`, `finish`, `cancel`, `clearAll`, `marks`, `setColor`, `diagnostics`) is the no-mouse test seam.
-- **The pointer, for an application's own tool.** `createApplicationTools` also returns `pointer` (`data/inputOwnership.js`): `claim(owner)` takes the pointer as Draw does and returns its lease, or `null` while another tool holds it; `release(lease)` gives it back; `isFree()` lets the application's own click handlers yield, as the layers' do. An owner without a name in `pointerOwnerNames.js` is named by its id when another tool reports who holds the pointer.
+- **The pointer, for an application's own tool.** `createApplicationTools` also returns `pointer` (`data/inputOwnership.js`): `claim(owner, { onLost })` takes the pointer as Draw does, from any tool holding it, and returns its lease; `onLost` is called once when a newer claim takes it, and the tool turns itself off there; `release(lease)` gives it back; `isFree()` lets the application's own click handlers yield, as the layers' do.
- **Row actions are an application's own.** `createApplicationTools({ drawMarkActions })` hands `initDrawTool` buttons for drawn areas' and lines' rows; the standalone shell passes none, so the open-source build shows no new button and makes no new request. Each action (`drawMarkActions` in `src/annotations/drawMarks.js`) is `{ id, icon, label(name), shapes: ['area', 'line'], accepts?(geometry, shape), run({ id, shape, name, title, geometry }) }`: the icon a Material Symbols name, the label worded by the application, `name` the person's own and `title` the row's (the name, else `Area` or `Line · 950 m`), the geometry `drawMarkGeometry`'s `[lon, lat]` `Polygon` (closed; a `MultiPolygon` for an area handle with several parts) or `LineString`, longitudes wrapped into [-180, 180]. A pin, and a shape that crosses the antimeridian or has a part that cannot be given whole, has no geometry and is offered nothing. Malformed actions and repeated ids are dropped once, at construction. What `run` returns or resolves to is a note under the row (`role=status`; past 200 characters it is cut at a word with an ellipsis); the row is busy (`aria-disabled`, no second press) until it settles, a rejection or a throw clears the note and is logged (so an action words its own refusals and resolves with them), and a shape's note goes with the shape, so a late answer never lands on a removed one.
- Contract: a finished shape is submitted through the SAME `annotationEngine.annotate()` the voice agent uses, with geometry supplied and `manual: true` (`type: area` + `ring`, `type: route` + `path`, `type: pin` + coordinates). `resolveSpec` short-circuits manual specs (`resolveManualSpec`) so no geocoder, Places or Overpass call is made. A drawn area is a real (not synthesized) outline and drapes solid; a drawn line is a `route` with `mode: 'manual'`, labelled with its length and never a travel time; a pin is a point. Drawn marks therefore render with the whiteboard look, persist, appear in `.list()`, and clear with `clear_annotations` / `.clear()`. A drawn shape is never merged with another as a duplicate: every one is drawn on purpose, and every one is unnamed until its row names it, so two pins dropped close together are two pins.
- **A vertex is a lon/lat, and the mark is DRAPED.** Clicks are picked through `pickWorldFromScreen` — one of two scene helpers the annotation resolver factory (`src/annotations/resolver.js`) exposes alongside `sampleGroundHeight`, so the app has ONE depth-aware pick cascade rather than a second written beside it — which returns the height the pick landed on as well as the coordinate, so the live preview hangs on the roof or hillside under the pointer instead of sinking to sea level. The world renderer draws areas and routes with `clampToGround`, so the height is dropped at finish in one place (`finishSpec`) rather than being carried downstream and discarded silently: what you get is the outline you drew, lying on the surface beneath it.
@@ -7697,7 +7702,7 @@ request viewbox and continues searching without that geographic preference.
- Drawn-area measures round before choosing m², ha or km², so 9,999.6 m² displays as `1.0 ha`, not `10000 m²`, and 999,960 m² as `1.00 km²`, not `100.0 ha`.
- Pointer ownership: while a session is open the tool holds the single pointer claim (`claimPointer('draw')`, `src/data/inputOwnership.js`), and the scene's input dispatcher (`src/input/dispatcher.js`) hands its clicks, moves and double clicks to the draw tool's leased subscriptions only: **every** ambient subscriber — flights, military, CCTV and its calibration gizmo, vessels, satellites, launches, fires, installations, bikeshare, radio, submarine cables, the bundled GeoJSON layers — is skipped for that event before anything is picked. A vertex over an aircraft is a vertex, not a selection.
- The input dispatcher no longer reaches Cesium. It takes its pointer events from the renderer's input port (`findInput`, `src/render/rendererOf.js`) and its picks, drills and ground points from the query port, with positions as plain `{x, y}`. A click's hits are the contract's `Hit`; something drawn outside the draw port is a `Hit` with `set: ''` that the Cesium adapter names (`src/render/cesium/nativeClick.js`), which also hangs the engine's own picks on `event.native` (`pick`, `pickWindow`, `drill`, through the follow helper) for layers still bound to them. The adapter's pick reuses the query port's pass for the same pixel, window and frame, so an empty click still costs one pick pass; a sky click makes no depth pass unless a globe tile is on its ray. A touch tap's contact search drills Cesium's own picks, eight deep, so something drawn outside the draw port still stops it or is found by it.
-- **The claim is a LEASE.** `claimPointer(owner)` returns an opaque token or `null`; `releasePointer(lease)` takes that token. A second claim fails even under the same owner name, because two live instances of one tool — an old one mid-teardown and its replacement — are two owners; releasing by name let the old instance free the claim its successor was holding, and every layer started selecting through the live session's vertices. A superseded lease now releases nothing.
+- **The claim is a LEASE, and the newest claim takes over.** `claimPointer(owner, { onLost })` returns an opaque token; `releasePointer(lease)` takes that token. A second claim, even under the same owner name, ends the lease out, and its holder's `onLost` is called once, after the new lease holds the pointer: Draw turns off as if toggled off (the half-drawn shape and preview go, the stock clicks come back), the imagery box cancels, and Directions disarms. Two live instances of one tool — an old one mid-teardown and its replacement — are two owners, so the replacement wins; releasing by name let the old instance free the claim its successor was holding, and every layer started selecting through the live session's vertices. A superseded lease releases nothing. This is the renderer contract's rule (`input.claimPointer`), and the two are one: each scene's input dispatcher bridges its renderer's input port (`bridgePointer`), so the port holds a lease while a tool holds the pointer (the port is not free), and a claim made on the port itself takes over from the tool like any newer claim. That lease takes no press itself: the dispatcher decides who hears each event when it arrives, as each layer's own handler used to (a click reaches ambient selection only if no tool holds the pointer then, and a tool's subscribers only while its lease is current), and Cesium's own select and double-click follow run unless the tool holds them off (`suppressStockClicks`: Draw and the imagery box do, Directions does not).
- **Cesium's own click actions are suppressed too.** The Viewer binds a selecting LEFT_CLICK and a tracking LEFT_DOUBLE_CLICK on its own handler, outside every layer and therefore outside the shared claim — guarding the layers alone still left a drawn vertex selecting the entity under it. The tool takes the dispatcher's `suppressStockClicks()` hold for the session; both actions come back, as the same function objects, when the last hold is released (the imagery box takes the same hold).
- **Enter belongs to whatever has the keyboard.** The finish key is taken only from the canvas and the page body. With a control focused — Clear, a shape button — Enter activates that control, as a keyboard user expects; it does not quietly finish the shape.
- Pure half: `src/annotations/drawMode.js` (session, minimum vertices, double-click de-dup at 0.5 m, vertex ceiling, degenerate-geometry refusal, ring closing, dateline-safe length/area/centroid, hint text). Regression surface: `src/annotations/drawMode.test.mjs` and `src/data/inputOwnership.test.mjs` (pure), `src/annotations/drawToolBehaviour.test.mjs` (the tool driven against DOM and viewer doubles — leases, borrowed input actions, teardown, the Enter key, preview heights), `src/annotations/drawTool.test.mjs` (structural: where files live, which ids the markup carries, what the docs may claim), and the rendered harness `scripts/qa-draw-tool.mjs`.
@@ -8090,7 +8095,10 @@ plus the renderer itself. `PORTS` lists every member at run time, and
camera's exact maths. `src/render/conformance/` is the suite: logic checks
in Node, plus camera traces recorded from Cesium's own `Camera` into
`goldens/camera.json`. It also holds the reference scenes, whose views are
-checked against `goldens/visual/` on the `/dev/conformance/` page. See
+checked against `goldens/visual/` on the `/dev/conformance/` page.
+`npm run qa:conformance` runs the logic checks on the Cesium renderer in
+headless Chromium, in CI too. After `destroy()` the Cesium renderer's
+handles do nothing, and `renderOnce` and `capture` reject. See
[RENDERER-CONTRACT.md](RENDERER-CONTRACT.md).
### The application and its renderer
diff --git a/docs/RENDERER-CONTRACT.md b/docs/RENDERER-CONTRACT.md
index b3538d2a1..33e62f0d5 100644
--- a/docs/RENDERER-CONTRACT.md
+++ b/docs/RENDERER-CONTRACT.md
@@ -6,7 +6,7 @@ it meets the contract. The contract is version `0`. Today the application
still drives Cesium directly; later work moves the layers onto the contract
one family at a time.
-The package exports four modules:
+The package exports these modules:
| Export | What it is |
| ------------------------------------ | -------------------------------------------------------------------------------------- |
@@ -15,10 +15,31 @@ The package exports four modules:
| `gods-eye-view/render/camera/events` | The camera port's events: `changed` per listener, `moveStart`/`moveEnd`, command hooks |
| `gods-eye-view/render/conformance` | The conformance suite, reference scenes and visual comparison |
+The pieces that do not depend on Cesium are exported too, each with its
+these exports too, each with its own `.d.ts`:
+
+- `gods-eye-view/render/input/router`: the input port's leases and routing;
+- `gods-eye-view/render/stub/camera`, `.../stub/viewRectangle` and
+ `.../stub/harness`: the stub's camera, its view rectangle and its
+ conformance harness;
+- `gods-eye-view/render/motion`: where a moving icon is drawn at a time;
+- `gods-eye-view/render/vectorBase`: the vector base painter;
+- `gods-eye-view/render/iconSegment`: icon motion segments;
+- `gods-eye-view/render/recession`: how a set that recedes shrinks and
+ fades its items toward the limb;
+- `gods-eye-view/render/windStreamlines`: the wind field's streamlines;
+- `gods-eye-view/geo/screenCluster`: screen-space clustering.
+
+`src/render/neutralExports.test.mjs` checks that each is declared, that its
+names match what it exports, that it type-checks under strict TypeScript and
+that it imports no Cesium.
+
A camera of its own (a camera controller over a renderer without one) can
take the camera events from `render/camera/events` and the geodesy it needs
(`geodesicAt`, `horizonFrom` and the rest) from `gods-eye-view/geo`, so it
-measures and fires exactly as the stub does.
+measures and fires exactly as the stub does. `CameraControllerFactory`
+(`camera.d.ts`) types such a controller: what it is given (`NativeCamera`)
+and what it gives back (the camera port and its two frame steps).
## Ports
@@ -98,6 +119,23 @@ optional, so a renderer written before it still conforms:
flat colour (false); omitted, extruded shapes are lit and the rest flat,
as before. The Cesium port lights unclamped shapes only
(clamped ones drape unlit). The `shapes-lit` scene draws both.
+- `SetSpec.recede` (`RecedeSpec`, for icon and model sets) makes a set's
+ items shrink and fade toward the globe's limb, replacing the icon item's
+ own `recede` flag. Its parameters (each optional: where receding starts
+ as a share of the limb's distance, the scale and haze reached at the
+ limb, the least focus × haze draws with, and the eye heights over which
+ it all eases off for a view of the whole globe) and the maths are
+ `render/recession`'s, so the renderer draws exactly those factors: an icon
+ draws at its scale times the scale factor, and an icon or model at its
+ alpha times `max(combinedAlphaFloor, focus × haze)`. `ModelItem.focus`
+ dims a model as `IconItem.focus` dims an icon. It changes live
+ (`setOptions`). The Cesium port draws a receding icon set on the GPU,
+ the factors worked out in its shader, and fades a receding model set's
+ models each frame before the scene draws, writing a model's colour again
+ once its focus and haze move by more than 0.005. The check
+ `draw.sets.recede` makes and changes both kinds, and
+ `draw.sets.recede.models` reads a receding model's pixels: at focus 0.25
+ it draws faded, and a `combinedAlphaFloor` of 1, set live, brings it back.
- `SetSpec.drawOrder` stacks sets drawn over depth: a higher one draws over
a lower one and is picked first; equal ones keep the order they were
made in. The Cesium port stacks opaque icons and points by it;
@@ -142,13 +180,10 @@ it while `globe.sky`'s `fog` is on.
`weather` adds `globe.weather`: clouds, fog, haze, rain and snow drawn
around the view, each a strength from 0 to 1, with the wind they drift on.
-`src/render/weather.js` keeps and clamps them alike for the renderer
-(`mergeWeather`). The app's `src/viewWeather.js` sets the conditions observed
-under the camera (the weather service, through
-`deriveWeatherEffectProfile`), asking again after five minutes or 25 km,
-and none from orbit; the Display panel's Weather group turns live off and
-sets clouds, fog, rain and snow by hand, and shows only on a renderer that
-lists `weather`. The Cesium port does not list it. The strengths say what
+`src/render/weather.js` (exported as `./render/weather`) keeps and clamps
+them (`mergeWeather`), and `./weather/effects`
+turns a weather observation into strengths (`deriveWeatherEffectProfile`).
+The application sets none, and the Cesium port does not list it. The strengths say what
is observed (`clouds` is the fraction of the sky covered), not how it is
drawn: the renderer draws clouds, fog and haze its own way, with clouds
placed by scene time and the wind, and shading the ground under them where
@@ -205,7 +240,7 @@ quad given another source lets the old blob go with its old material, once the
frame has drawn), a
keyed canvas, and an atlas slot as the image it holds (an icon waits for an
unregistered slot; anything else refuses it). The check `draw.icons.images`
-draws each kind on still and receding icons.
+draws each kind on still icons and in a set that recedes.
Icon sets with `cluster` (`ClusterSpec`) cluster the same way on every
renderer: `clusterScreenPoints` (`src/geo/screenCluster.js`) over the shown
@@ -218,7 +253,7 @@ and `meta` and the cluster's position, so `pick` gives the seed and
`drillPick` every member. Clusters are made again in the frames drawn after
the camera moves or the set changes, never on a timer. The Cesium port draws
a set's cluster icons in a billboard collection of their own and hides the
-members' billboards. A set on the GPU (`columns`, or moving, receding,
+members' billboards. A set on the GPU (`columns`, a set that recedes, or moving,
proxy-picked or level-of-detail icons) clusters its rows where their segments
(and ground) put them at the frame's motion-clock time, hiding the members'
rows; while rows still move it clusters again every frame. The checks
@@ -336,9 +371,35 @@ The rules that hold everywhere:
follow → `preUpdate` → move detection → `preRender` → render →
`postRender`, the default renderer's own. A camera move made by follow or
in `preUpdate` is reported by `changed` on the next frame.
+- **Destroy ends everything.** After `destroy()`, every handle does
+ nothing: a set's or field's methods neither draw nor throw, and a set or
+ field asked for afterwards is such a handle. The same holds for one handle
+ after its own `dispose()`. `frame.renderOnce()` and `capture()` reject
+ with a "renderer destroyed" error, and a `renderOnce` still waiting at
+ destroy rejects rather than hang.
+- **Results are read-only.** `camera.matrices()` and `followFrame()` may
+ hand the same arrays again while they hold, and hand new ones once they
+ change, so one kept from an earlier frame stays as it was.
+- **Reading the frame.** `capture()` and `readPixels()` read the last
+ presented frame; neither draws one of its own when the frame is kept.
+ Whether to keep the drawing buffer is the renderer's own business, not a
+ creation option. The creation options a renderer takes are `msaa`, `sky`
+ and `time`, set before the first frame, and `clock`, which its frame
+ ticks, the camera's `moveEnd` wait, its input and its flights read, and
+ its inertia where the renderer times that itself: on Cesium, inertia
+ keeps Cesium's own timing.
- **Leases:** a tool takes the pointer with `claimPointer`. With `grab`, it
takes only the presses it grabs on `down`; the rest, and wheel and pinch,
- stay with the camera and everyone else.
+ stay with the camera and everyone else. The newest claim takes over: it
+ ends the previous lease, whose `onLost` is called once, after the new lease
+ holds the pointer, so that tool turns itself off. A lease its holder
+ releases is never told, and an ended lease's release frees nothing.
+ The application's own tools (Draw, the imagery box, Directions) claim through
+ `src/data/inputOwnership.js`, which the input dispatcher bridges onto the
+ port, so a claim on either takes over from the other. The bridge's lease
+ grabs no press: the dispatcher decides who hears each event when it
+ arrives, and the renderer's stock select and double-click follow run
+ unless a tool holds them off.
`src/render/contract/index.js` lists every member of every port in `PORTS`,
along with `CAPABILITIES`, `FRAME_STEPS` and `QUALITY_KEYS`.
@@ -586,8 +647,10 @@ renderer under test:
Optional members widen what is checked: `pointer` for synthetic input,
`cameraInput` (the camera answers that input: the drag and wheel traces
-run), `scriptHeights`, `assets.model`, and `assets.missingModel` (a model
-url that fails to load, for the `loadFailed` check). `pixels: false` says
+run), `scriptHeights`, `resizeContainer` (sizes the element the renderer
+fills, for the `resize` check, which skips without it), `assets.model`, and
+`assets.missingModel` (a model url that fails to load, for the `loadFailed`
+check). `pixels: false` says
the renderer draws nothing but models into its pixels, as the stub: the
checks that read drawn icons, lines and fields then skip. Without it they
run, and the renderer fails them if it draws nothing there.
@@ -661,6 +724,13 @@ The scenes load nothing from the network.
The page shows the capture, the reference and the difference side by side.
`window.conformance.runScenes()` and `runLogic()` do the same from a script.
+
+`npm run qa:conformance` runs the logic checks on the Cesium renderer in
+headless Chromium (software WebGL, no GPU needed). It starts its own Vite
+server unless given `--url`; `--only id,id` runs just those checks and
+`--json path` writes the report. It fails on any failed check and on any
+skip it does not expect (`query.heights`, which needs scripted heights, is
+the one it expects). CI runs it in the `street-level-browser` job.
Browser checks use the chrome-devtools MCP against a page in its own window.
The Cesium scene renderer (`src/render/cesium/sceneRenderer.js`) draws
diff --git a/package.json b/package.json
index b6fe8c80f..1a7f64a6d 100644
--- a/package.json
+++ b/package.json
@@ -54,6 +54,7 @@
"test:perf": "node scripts/run-perf-tests.mjs",
"test:track": "node scripts/track-regression.mjs",
"qa:stub-boot": "node scripts/qa-stub-boot.mjs",
+ "qa:conformance": "node scripts/qa-conformance.mjs",
"qa:map-source-tray": "node scripts/qa-map-source-tray.mjs",
"qa:street-level": "node scripts/qa-street-level.mjs",
"qa:street-level:fixtures": "node scripts/qa-street-level.mjs --fixtures",
@@ -165,6 +166,7 @@
"./ui/layout": "./src/ui/panelRails.js",
"./ui/input": "./src/ui/visualInput.js",
"./ui/display": "./src/ui/displayControls.js",
+ "./ui/display/groups": "./src/ui/displayGroups.js",
"./ui/effects": "./src/ui/effects.js",
"./ui/effects/bloom": "./src/bloom.js",
"./ui/maps": "./src/ui/mapSource.js",
@@ -332,6 +334,18 @@
"./render/cesium/plugin": "./src/render/cesium/plugin.js",
"./render/cesium/unbound": "./src/render/cesium/unbound.js",
"./render/conformance": "./src/render/conformance/index.js",
+ "./render/input/router": "./src/render/input/router.js",
+ "./render/stub/camera": "./src/render/stub/camera.js",
+ "./render/stub/viewRectangle": "./src/render/stub/viewRectangle.js",
+ "./render/stub/harness": "./src/render/stub/harness.js",
+ "./render/motion": "./src/render/motion/iconMotion.js",
+ "./render/vectorBase": "./src/render/vectorBase/index.js",
+ "./render/iconSegment": "./src/data/iconSegment.js",
+ "./render/recession": "./src/render/recession.js",
+ "./render/windStreamlines": "./src/layers/wind/streamlines.js",
+ "./render/weather": "./src/render/weather.js",
+ "./weather/effects": "./src/weatherEffectsMath.js",
+ "./geo/screenCluster": "./src/geo/screenCluster.js",
"./layers/wildlife-sightings": "./src/layers/wildlifeSightings/index.js",
"./layers/wildlife-sightings/source": "./src/layers/wildlifeSightings/source.js"
}
diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json
index 0f1a6c7bf..4147d8f6c 100644
--- a/scripts/package-boundaries.json
+++ b/scripts/package-boundaries.json
@@ -12,6 +12,7 @@
"src/render/cesium/heights.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconAtlas.js",
"src/data/iconSet.js",
@@ -804,6 +805,37 @@
"modules": ["src/ui/displayControls.js"],
"external": []
},
+ "display-groups": {
+ "exports": ["./ui/display/groups"],
+ "modules": [
+ "src/ui/displayGroups.js",
+ "src/ui/vueRuntime.js",
+ "src/ui/stores/display.js",
+ "src/ui/stores/owners.js",
+ "src/i18n/locale.js",
+ "src/i18n/locales/ar.json",
+ "src/i18n/locales/de.json",
+ "src/i18n/locales/es.json",
+ "src/i18n/locales/fr.json",
+ "src/i18n/locales/it.json",
+ "src/i18n/locales/he.json",
+ "src/i18n/locales/ja.json",
+ "src/i18n/locales/sv.json",
+ "src/i18n/locales/pt.json",
+ "src/i18n/locales/ru.json",
+ "src/i18n/locales/zh-CN.json",
+ "src/i18n/locales/uk.json",
+ "src/i18n/locales/zh-Hant.json",
+ "src/i18n/index.js",
+ "src/ui/i18n.js"
+ ],
+ "external": ["vue", "pinia", "vue-i18n"]
+ },
+ "weather-effects": {
+ "exports": ["./render/weather", "./weather/effects"],
+ "modules": ["src/render/weather.js", "src/weatherEffectsMath.js"],
+ "external": []
+ },
"visual-effects": {
"exports": ["./ui/effects", "./ui/effects/bloom"],
"modules": [
@@ -1068,6 +1100,7 @@
"src/ui/cockpitCamera.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/motionModel.js",
"src/data/iconAtlas.js",
@@ -1261,6 +1294,7 @@
"src/renderGovernor.js",
"src/data/bundledJson.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/motionModel.js",
"src/geo/julian.js",
@@ -1637,6 +1671,7 @@
"src/data/followed.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/motionModel.js",
"src/data/iconSet.js",
@@ -1825,6 +1860,7 @@
"src/render/cesium/setBlend.js",
"src/geo/screenCluster.js",
"src/render/cesium/drawModels.js",
+ "src/render/recession.js",
"src/geo/polyline.js",
"src/render/cesium/gpuIcons.js",
"src/render/motion/iconMotion.js",
@@ -1971,6 +2007,7 @@
"src/render/cesium/setBlend.js",
"src/geo/screenCluster.js",
"src/render/cesium/drawModels.js",
+ "src/render/recession.js",
"src/geo/polyline.js",
"src/render/cesium/gpuIcons.js",
"src/render/motion/iconMotion.js",
@@ -2129,6 +2166,7 @@
"src/layers/vessels/iconBook.js",
"src/data/entityRecords.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
"src/data/iconSegment.js",
@@ -2291,6 +2329,7 @@
"src/data/iconSet.js",
"src/data/iconAtlas.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/render/motion/iconMotion.js",
"src/render/cesium/heights.js",
"src/render/baseTilesets.js",
@@ -2347,6 +2386,7 @@
"src/render/cesium/imageryFrames.js",
"src/render/cesium/tileRequests.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/motionModel.js",
"src/geo/julian.js",
@@ -2511,6 +2551,7 @@
"src/render/cesium/drawQuads.js",
"src/render/cesium/drawMeshes.js",
"src/render/cesium/drawModels.js",
+ "src/render/recession.js",
"src/geo/polyline.js",
"src/render/cesium/gpuIcons.js",
"src/render/motion/iconMotion.js",
@@ -2607,6 +2648,7 @@
"src/layers/satellites/tracking.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -2697,6 +2739,7 @@
"src/layers/launches/index.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/motionModel.js",
"src/geo/julian.js",
@@ -2796,6 +2839,7 @@
"src/geo/geodesic.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconAtlas.js",
"src/data/motionModel.js",
@@ -3023,6 +3067,7 @@
"src/layers/traffic/viewport.js",
"src/render/rendererOf.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
"src/data/aircraftRecession.js",
@@ -3212,6 +3257,7 @@
"src/render/cesium/drawQuads.js",
"src/render/cesium/drawMeshes.js",
"src/render/cesium/drawModels.js",
+ "src/render/recession.js",
"src/geo/polyline.js",
"src/render/cesium/gpuIcons.js",
"src/render/motion/iconMotion.js",
@@ -3303,6 +3349,7 @@
"src/layers/streetLevel/index.js",
"src/render/cesium/credits.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -3534,6 +3581,7 @@
"src/data/followed.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -3736,6 +3784,7 @@
"src/render/cesium/globe.js",
"src/render/baseTilesets.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -3977,6 +4026,7 @@
"src/hudLayoutPolicy.js",
"src/ui/radioPanelPlacement.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/iconSet.js",
"src/data/iconSegment.js",
"src/data/iconAtlas.js",
@@ -4686,7 +4736,6 @@
"src/ui/geoFileImport.js",
"src/data/routeSteps.js",
"src/layers/directions/index.js",
- "src/data/pointerOwnerNames.js",
"src/layers/directions/source.js",
"src/data/directions.js",
"src/app/layers/directions.js",
@@ -5313,7 +5362,6 @@
"src/data/openVesselPhoto.js",
"src/layers/vessels/photos.js",
"src/viewSky.js",
- "src/viewWeather.js",
"src/render/weather.js",
"src/layers/flights/placed.js",
"src/data/placementProvider.js",
@@ -5354,6 +5402,7 @@
"src/data/aircraftMotionRegime.js",
"src/geo/julian.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/iconSet.js",
"src/data/iconSegment.js",
"src/data/iconAtlas.js",
@@ -5800,7 +5849,6 @@
"src/services/groundFloor.js",
"src/data/routeSteps.js",
"src/layers/directions/index.js",
- "src/data/pointerOwnerNames.js",
"src/layers/directions/source.js",
"src/services/terrainHeights.js",
"src/data/terrainHeights.js",
@@ -6194,6 +6242,7 @@
"src/locations.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -6352,6 +6401,7 @@
"src/ui/navigationController.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -6642,7 +6692,6 @@
"src/render/rendererOf.js",
"src/geo/vector.js",
"src/render/color.js",
- "src/data/pointerOwnerNames.js",
"src/layers/directions/source.js",
"src/data/routeSteps.js",
"src/i18n/index.js",
@@ -6991,6 +7040,7 @@
"src/celestialRing.js",
"src/render/cesium/camera.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -7167,6 +7217,7 @@
"src/geo/rectangle.js",
"src/render/rendererOf.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/iconSet.js",
"src/geo/horizon.js",
@@ -7518,6 +7569,7 @@
"src/input/dispatcher.js",
"src/render/cesium/drawHit.js",
"src/render/cesium/iconSetPrimitive.js",
+ "src/render/recession.js",
"src/data/aircraftRecession.js",
"src/data/motionModel.js",
"src/data/iconSet.js",
@@ -7923,7 +7975,17 @@
"./render/occlusion",
"./render/camera/events",
"./render/camera/followTransition",
- "./render/conformance"
+ "./render/conformance",
+ "./render/input/router",
+ "./render/stub/camera",
+ "./render/stub/viewRectangle",
+ "./render/stub/harness",
+ "./render/motion",
+ "./render/vectorBase",
+ "./render/iconSegment",
+ "./render/recession",
+ "./render/windStreamlines",
+ "./geo/screenCluster"
],
"modules": [
"src/render/contract/index.js",
@@ -7966,7 +8028,13 @@
"src/render/vectorBase/paint.js",
"src/render/vectorBase/expressions.js",
"src/render/vectorBase/encode.js",
- "src/render/weather.js"
+ "src/render/weather.js",
+ "src/render/stub/harness.js",
+ "src/data/iconSegment.js",
+ "src/data/motionModel.js",
+ "src/layers/wind/streamlines.js",
+ "src/layers/wind/model.js",
+ "src/render/recession.js"
],
"external": ["pbf", "@mapbox/vector-tile", "kdbush"]
},
diff --git a/scripts/qa-conformance.mjs b/scripts/qa-conformance.mjs
new file mode 100644
index 000000000..98992f9dc
--- /dev/null
+++ b/scripts/qa-conformance.mjs
@@ -0,0 +1,119 @@
+#!/usr/bin/env node
+/**
+ * Run the renderer conformance logic suite on the Cesium renderer in
+ * headless Chromium (`dev/conformance/`, `window.conformance.runLogic`),
+ * and fail on any failed check, or on a skip that is not expected.
+ *
+ * Without `--url` it starts a Vite dev server of this checkout on `--port`
+ * (default 5289) and stops it after. WebGL runs on SwiftShader, so the run
+ * needs no GPU. `--only id,id` runs just those checks; `--json path` writes
+ * the report.
+ *
+ * npm run qa:conformance [-- --url http://127.0.0.1:5280] [--only ids]
+ * [--json path]
+ */
+import { writeFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import puppeteer from 'puppeteer';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+
+/** Checks the run skips, with why: anything else skipped fails it. */
+export const EXPECTED_SKIPS = Object.freeze({
+ // The page scripts no heights for the Cesium renderer.
+ 'query.heights': 'no scripted heights in this harness',
+});
+
+/** A whole run has this long; a check that hangs fails it rather than CI. */
+const RUN_TIMEOUT_MS = 15 * 60_000;
+
+function parseArgs(argv) {
+ const args = { port: 5289 };
+ for (let i = 0; i < argv.length; i++) {
+ const arg = argv[i];
+ if (arg === '--url') args.url = argv[++i];
+ else if (arg === '--port') args.port = Number(argv[++i]);
+ else if (arg === '--only') args.only = argv[++i].split(',');
+ else if (arg === '--json') args.json = argv[++i];
+ else throw new Error(`Unknown argument: ${arg}`);
+ }
+ return args;
+}
+
+async function startViteServer(port) {
+ const { createServer } = await import('vite');
+ const server = await createServer({
+ root: ROOT,
+ configFile: path.join(ROOT, 'vite.config.js'),
+ // No hot reload: the page is loaded once and nothing edits it.
+ server: { port, strictPort: true, host: '127.0.0.1', hmr: false },
+ logLevel: 'warn',
+ });
+ await server.listen();
+ return server;
+}
+
+async function main() {
+ const args = parseArgs(process.argv.slice(2));
+ const server = args.url ? null : await startViteServer(args.port);
+ try {
+ await run(args);
+ } finally {
+ await server?.close();
+ }
+}
+
+async function run(args) {
+ const base = (args.url ?? `http://127.0.0.1:${args.port}`).replace(/\/$/, '');
+ const browser = await puppeteer.launch({
+ headless: true,
+ executablePath:
+ process.env.PUPPETEER_EXECUTABLE_PATH ||
+ (await puppeteer.executablePath()),
+ defaultViewport: { width: 1280, height: 800 },
+ protocolTimeout: RUN_TIMEOUT_MS,
+ args: ['--no-sandbox', '--use-gl=angle', '--use-angle=swiftshader'],
+ });
+ const pageErrors = [];
+ let report;
+ try {
+ const page = await browser.newPage();
+ page.on('pageerror', (error) => pageErrors.push(error.message));
+ await page.goto(`${base}/dev/conformance/`, { waitUntil: 'load' });
+ await page.waitForFunction(() => window.conformance?.runLogic, {
+ timeout: 120_000,
+ });
+ report = await page.evaluate(
+ (only) => window.conformance.runLogic('cesium', { only }),
+ args.only ?? null,
+ );
+ } finally {
+ await browser.close();
+ }
+ if (args.json) writeFileSync(args.json, JSON.stringify(report, null, 2));
+ console.log(
+ `cesium: ${report.passed} passed, ${report.failed} failed, ${report.skipped} skipped`,
+ );
+ const problems = [];
+ for (const failure of report.failures) {
+ console.error(`fail\t${failure.id}\t${failure.detail ?? ''}`);
+ problems.push(failure.id);
+ }
+ for (const skip of report.skips) {
+ const expected = EXPECTED_SKIPS[skip.id] === skip.detail;
+ console.log(`skip\t${skip.id}\t${skip.detail ?? ''}`);
+ if (!expected) problems.push(`${skip.id} skipped`);
+ }
+ if (!args.only && report.passed === 0) problems.push('nothing passed');
+ if (problems.length) {
+ console.error(`FAIL: ${problems.join('; ')}`);
+ process.exitCode = 1;
+ } else console.log('ok: the Cesium renderer passes the conformance suite');
+}
+
+if (import.meta.url === `file://${process.argv[1]}`)
+ main().catch((error) => {
+ console.error(error);
+ process.exitCode = 1;
+ });
diff --git a/scripts/qa-directions.mjs b/scripts/qa-directions.mjs
index 9fb8b9802..f0af5c045 100644
--- a/scripts/qa-directions.mjs
+++ b/scripts/qa-directions.mjs
@@ -645,44 +645,34 @@ try {
`owner=${afterClear.pointerOwner}`,
);
- // ── 8. A tool holding the pointer blocks placement, and says so. ─────────
+ // ── 8. Arming takes the pointer from a tool holding it, which is told. ──
await page.evaluate(() => {
+ window.__gevQaDrawLost = 0;
// A claim answers with a lease; the release takes that lease back.
- window.__gevQaDrawLease = window.__gevQa.claimPointer('draw');
+ window.__gevQaDrawLease = window.__gevQa.claimPointer('draw', {
+ onLost: () => (window.__gevQaDrawLost += 1),
+ });
});
await clickChip('set-a');
- const blocked = await layerState();
+ const taken = await layerState();
+ const lost = await page.evaluate(() => window.__gevQaDrawLost);
check(
- "another tool's pointer claim is never stolen",
- blocked.pointerOwner === 'draw',
- `owner=${blocked.pointerOwner}`,
+ 'the newest claim takes over: Directions holds the pointer',
+ taken.pointerOwner === 'directions',
+ `owner=${taken.pointerOwner}`,
);
+ check('the tool it replaced is told once', lost === 1, `told=${lost}`);
check(
- 'nothing is armed, and the row says why the click would do nothing',
- blocked.chips.find((chip) => chip.id === 'set-a')?.active === false &&
- /Another map tool/.test(blocked.stats.error || ''),
- blocked.stats.error,
+ 'SET A is armed, and the row has nothing to complain of',
+ taken.chips.find((chip) => chip.id === 'set-a')?.active === true &&
+ !taken.stats.error,
+ taken.stats.error,
);
- // The row is not where the operator is looking after pressing a chip, so the
- // refusal also has to reach the app's toast (owner field test).
- const toast = await page.evaluate(() => {
- const node = document.getElementById('toast');
- return {
- text: node?.textContent || '',
- visible: !!node?.classList.contains('visible'),
- };
- });
- check(
- 'the refusal reaches the app toast, naming the tool and how to leave it',
- /Draw is active/.test(toast.text) && /then set A/.test(toast.text),
- JSON.stringify(toast.text),
- );
- check('and that toast is actually on screen', toast.visible);
- await shot(`05-${LABEL}-pointer-blocked-toast.jpg`);
- const released = await page.evaluate(() =>
+ const staleReleased = await page.evaluate(() =>
window.__gevQa.releasePointer(window.__gevQaDrawLease),
);
- check('and it gets the pointer back when it lets go', released);
+ check("the replaced tool's late release frees nothing", !staleReleased);
+ await clickChip('set-a');
// ── 9. Denver: maneuver dots sit on the ground, not at sea level. ────────
if (!SKIP.has('denver')) {
diff --git a/scripts/qa-geo-import-large.mjs b/scripts/qa-geo-import-large.mjs
index 3e4c7f5b7..59b6908d1 100644
--- a/scripts/qa-geo-import-large.mjs
+++ b/scripts/qa-geo-import-large.mjs
@@ -176,7 +176,8 @@ try {
kind: 'pin',
point: [+i.pos.lon.toFixed(6), +i.pos.lat.toFixed(6)],
scale: i.scale ?? 1,
- heading: Math.round(i.course ?? 0),
+ // A KML heading is drawn as a turn on screen, clockwise.
+ heading: Math.round((-(i.rotation ?? 0) * 180) / Math.PI),
image: Boolean(i.image),
color: css(i.color ?? 'white'),
})),
diff --git a/scripts/qa-map-source-tray.mjs b/scripts/qa-map-source-tray.mjs
index 231725997..b07eb0613 100644
--- a/scripts/qa-map-source-tray.mjs
+++ b/scripts/qa-map-source-tray.mjs
@@ -342,7 +342,7 @@ try {
const before = {
activeId: controller.getActiveId(),
creditVisible: document.body.innerText.includes('Powered by Esri'),
- globeShown: styleManager.viewer.scene.globe.show,
+ globeShown: window.__godsEyeView.viewer.scene.globe.show,
hasLayer: Boolean(controller._imageryLayer),
};
provider?.errorEvent?.raiseEvent?.({ timesRetried: 0 });
@@ -369,7 +369,7 @@ try {
activeId: controller.getActiveId(),
lastError: controller.getState().lastError,
creditVisible: document.body.innerText.includes('Powered by Esri'),
- globeShown: styleManager.viewer.scene.globe.show,
+ globeShown: window.__godsEyeView.viewer.scene.globe.show,
hasLayer: Boolean(controller._imageryLayer),
active: [...document.querySelectorAll('.map-stack-chip')]
.filter((chip) => chip.getAttribute('aria-pressed') === 'true')
diff --git a/scripts/qa-transit-scenes.mjs b/scripts/qa-transit-scenes.mjs
index 1098ba460..d75d235fd 100644
--- a/scripts/qa-transit-scenes.mjs
+++ b/scripts/qa-transit-scenes.mjs
@@ -420,11 +420,13 @@ export async function runBostonMatrix({
window.__godsEyeView.dataManager.layers.get('transit').module;
layer._transitPartsForTest().selection.clearSelection();
const e = layer._transitStateForTest()._vehicles.get(key);
- // The billboard the draw port drew for it.
+ // The billboard the draw port drew for it: the last under its key,
+ // as the fleet sample above reads it (the fleet-models set draws
+ // one under the same key first).
const scene = window.__godsEyeView.viewer.scene;
const setIds = layer._transitSetIdsForTest();
let drawn = null;
- for (let i = 0; !drawn && i < scene.primitives.length; i++) {
+ for (let i = 0; i < scene.primitives.length; i++) {
const host = scene.primitives.get(i);
if (!setIds.includes(host?.drawSetId)) continue;
for (let j = 0; j < host.length; j++)
diff --git a/scripts/qa-visual-effects.mjs b/scripts/qa-visual-effects.mjs
index 8cdf2acdb..3c96e6654 100644
--- a/scripts/qa-visual-effects.mjs
+++ b/scripts/qa-visual-effects.mjs
@@ -169,7 +169,7 @@ try {
result.bloom.intensityPct === 98 &&
snapshot.bloom.intensity === 98 &&
manager._visualEffects.bloomIntensity === 98 &&
- manager.viewer.scene.postProcessStages.bloom.enabled
+ window.__godsEyeView.viewer.scene.postProcessStages.bloom.enabled
);
}),
);
@@ -184,7 +184,7 @@ try {
manager.getVisualState().sharpen.intensity === 61 &&
manager._visualEffects.sharpenIntensity === 0.61 &&
Math.abs(
- manager.viewer.scene.postProcessStages.getStageByName(
+ window.__godsEyeView.viewer.scene.postProcessStages.getStageByName(
'effects_sharpen',
).uniforms.amount - 1.32,
) < 1e-9
@@ -203,7 +203,7 @@ try {
const manager = window.__godsEyeView.styleManager;
const effects = manager._visualEffects;
manager.setStyle('retro');
- const collection = manager.viewer.scene.postProcessStages;
+ const collection = window.__godsEyeView.viewer.scene.postProcessStages;
const owned = Object.keys(effects.stages).map((name) =>
collection.getStageByName(`effects_style_${name}`),
);
diff --git a/scripts/qa-visual-input.mjs b/scripts/qa-visual-input.mjs
index 0706c08e5..914476aeb 100644
--- a/scripts/qa-visual-input.mjs
+++ b/scripts/qa-visual-input.mjs
@@ -150,7 +150,9 @@ try {
manager._bloomSlider.focus();
return {
value: Number(manager._bloomSlider.value),
- contrast: manager.viewer.scene.postProcessStages.bloom.uniforms.contrast,
+ contrast:
+ window.__godsEyeView.viewer.scene.postProcessStages.bloom.uniforms
+ .contrast,
};
});
await page.keyboard.press('ArrowRight');
@@ -160,8 +162,8 @@ try {
const manager = window.__godsEyeView.styleManager;
return (
Number(manager._bloomSlider.value) > before.value &&
- manager.viewer.scene.postProcessStages.bloom.uniforms.contrast <
- before.contrast
+ window.__godsEyeView.viewer.scene.postProcessStages.bloom.uniforms
+ .contrast < before.contrast
);
}, displayBefore),
);
@@ -269,14 +271,15 @@ try {
manager._displayBindings._detachDisplayControls();
const before = manager.bloomEnabled;
const contrast =
- manager.viewer.scene.postProcessStages.bloom.uniforms.contrast;
+ window.__godsEyeView.viewer.scene.postProcessStages.bloom.uniforms
+ .contrast;
manager._bloomBtn.click();
manager._bloomSlider.value = '15';
manager._bloomSlider.dispatchEvent(new Event('input', { bubbles: true }));
return (
manager.bloomEnabled === before &&
- manager.viewer.scene.postProcessStages.bloom.uniforms.contrast ===
- contrast
+ window.__godsEyeView.viewer.scene.postProcessStages.bloom.uniforms
+ .contrast === contrast
);
}),
);
diff --git a/src/annotations/drawTool.js b/src/annotations/drawTool.js
index bc4285388..b1f8d1d05 100644
--- a/src/annotations/drawTool.js
+++ b/src/annotations/drawTool.js
@@ -15,7 +15,8 @@
* (`src/data/inputOwnership.js`), and every ambient selection handler yields,
* so a vertex clicked on top of an aircraft or a camera is a vertex and
* nothing else. It is one claim consulted by all of them, not a list of
- * exceptions inside each.
+ * exceptions inside each. Turning Draw on takes the pointer from any tool
+ * holding it; a newer tool taking it turns Draw off.
* - Cesium's Viewer binds its OWN left click (select the entity under the
* pointer) and double click (track it) on the viewer's handler, outside every
* layer and therefore outside the shared claim. Both are suppressed for the
@@ -37,7 +38,6 @@ import {
releasePointer,
} from '../data/inputOwnership.js';
import { inputFor } from '../input/dispatcher.js';
-import { pointerOwnerName } from '../data/pointerOwnerNames.js';
import {
DRAW_SHAPES,
MAX_VERTICES,
@@ -59,7 +59,7 @@ import {
presentDrawMarks,
} from './drawMarks.js';
-import { onLocaleChange, t, translateKnown } from '../i18n/index.js';
+import { onLocaleChange, t } from '../i18n/index.js';
import { fromDegrees } from '../geo/index.js';
import { cssColor } from '../render/color.js';
import {
@@ -407,18 +407,15 @@ export function initDrawTool({
function setActive(next) {
if (destroyed || next === active) return active;
if (next) {
- lease = claimPointer(DRAW_POINTER_OWNER);
- if (!lease) {
- // Somebody else is using the pointer — possibly an older instance of
- // this same tool that has not finished tearing down. Say so instead of
- // half-starting.
- setHint(() =>
- t('{owner} is using the pointer — close it first.', {
- owner: translateKnown(pointerOwnerName(pointerOwner())),
- }),
- );
- return active;
- }
+ // The newest claim takes over: a tool holding the pointer is told and
+ // turns itself off, and a newer one turns Draw off as if the person had.
+ const claimed = claimPointer(DRAW_POINTER_OWNER, {
+ onLost: () => {
+ if (lease === claimed) setActive(false);
+ },
+ });
+ if (!claimed) return active;
+ lease = claimed;
}
active = next;
present();
diff --git a/src/annotations/drawToolBehaviour.test.mjs b/src/annotations/drawToolBehaviour.test.mjs
index 8df89da51..f2f9c4a8e 100644
--- a/src/annotations/drawToolBehaviour.test.mjs
+++ b/src/annotations/drawToolBehaviour.test.mjs
@@ -296,27 +296,42 @@ test('turning Draw on takes a lease and turning it off gives it back', async ()
}
});
-test('Draw refuses to start when something else holds the pointer', async () => {
+test('Draw takes the pointer from another tool, which is told', async () => {
const h = harness();
try {
- const other = claimPointer('directions');
+ let lost = 0;
+ claimPointer('directions', { onLost: () => (lost += 1) });
h.act('toggleDraw');
- assert.equal(h.tool.active, false, 'it must not half-start');
- assert.equal(pointerOwner(), 'directions', 'and must not steal the claim');
- // Named by its tool, not by the internal owner id.
- assert.equal(
- h.shown.view.hint,
- 'Directions is using the pointer — close it first.',
- );
- assert.equal(
- h.tool.diagnostics().sceneHandler,
- false,
- 'no handler was bound',
- );
+ assert.equal(h.tool.active, true, 'the newest claim takes over');
+ assert.equal(pointerOwner(), 'draw');
+ assert.equal(lost, 1, 'the other tool is told once');
+ } finally {
+ h.restore();
+ }
+});
+test('Draw turns off, as if toggled off, when a newer tool takes the pointer', async () => {
+ const h = harness({
+ beforeInput(viewer) {
+ viewer.screenSpaceEventHandler.setInputAction(() => {}, LEFT_CLICK);
+ },
+ });
+ try {
+ h.act('toggleDraw');
+ assert.equal(h.tool.diagnostics().stockSingleClick, false);
+ assert.ok(h.tool.addVertex(10, 20), 'a shape is under way');
+ const other = claimPointer('directions');
+ assert.equal(h.tool.active, false);
+ assert.equal(h.tool.session, null, 'the half-drawn shape is dropped');
+ assert.equal(h.shown.view.active, false, 'the Draw control reads off');
+ const after = h.tool.diagnostics();
+ assert.equal(after.sceneHandler, false, 'its subscriptions are gone');
+ assert.equal(after.stockSingleClick, true, 'the stock clicks are back');
+ assert.equal(after.previewItems, 0, 'the preview is cleared');
+ assert.equal(pointerOwner(), 'directions', 'the newer tool keeps it');
releasePointer(other);
h.act('toggleDraw');
- assert.equal(h.tool.active, true, 'and it starts once the pointer is free');
+ assert.equal(h.tool.active, true, 'and it turns on again when asked');
} finally {
h.restore();
}
diff --git a/src/app/controls.js b/src/app/controls.js
index 73fb36873..bec189ed3 100644
--- a/src/app/controls.js
+++ b/src/app/controls.js
@@ -2,7 +2,6 @@ import { catalogControlServices } from './catalog.js';
import { StyleManager } from '../ui/composition.js';
import { applyStartView, START_VIEW } from '../camera.js';
import { initCockpitCloudEffects } from '../cockpitCloudEffects.js';
-import { createViewWeather } from '../viewWeather.js';
import { createViewSky } from '../viewSky.js';
import { findGlobe } from '../render/rendererOf.js';
import { useDisplayStore } from '../ui/stores/display.js';
@@ -66,13 +65,6 @@ export function createApplicationControls({
weatherService: operations.requests.weather,
});
defer(() => cockpitCloudEffects?.destroy());
- // Clouds, fog, rain and snow on a renderer that draws them: the conditions
- // under the camera, or what the user sets in the Display panel.
- const viewWeather = createViewWeather(viewer, {
- weatherService: operations.requests.weather,
- store: useDisplayStore(applicationPinia()),
- });
- defer(() => viewWeather.destroy());
// The atmosphere, sun lighting, sun, moon, stars and Milky Way the user
// chooses in the Display panel.
const viewSky = createViewSky(viewer, {
diff --git a/src/app/tools.js b/src/app/tools.js
index e45cf324a..a9e67a3af 100644
--- a/src/app/tools.js
+++ b/src/app/tools.js
@@ -313,8 +313,9 @@ export function createApplicationTools({
terrain: operations.requests.terrain,
}),
);
- // An application's own tool takes the pointer as Draw does, and its own
- // click handlers yield while a tool holds it, as the layers' do
+ // An application's own tool takes the pointer as Draw does (the newest
+ // claim takes over; `claim(owner, {onLost})` tells the tool it replaces),
+ // and its own click handlers yield while a tool holds it, as the layers' do
// (data/inputOwnership.js).
return {
sceneDirector,
diff --git a/src/data/aircraftIconLayer.js b/src/data/aircraftIconLayer.js
index 2b593ebe7..9abf52751 100644
--- a/src/data/aircraftIconLayer.js
+++ b/src/data/aircraftIconLayer.js
@@ -32,6 +32,8 @@ import {
TRACKED_ICON_PX,
} from './aircraftIcons.js';
import { cockpitContactDotImage } from './cockpitContactDot.js';
+import { aircraftRecedeSpec } from './aircraftRecession.js';
+import { TIMELINE_UNSEEN_MS } from '../time/timelineFixes.js';
/** Raster size of the cockpit contact pip (cockpitContactDot.js draws 16 px). */
const COCKPIT_DOT_PX = 16;
@@ -97,6 +99,14 @@ export function createContactIcons(drawSet = null, { capabilities } = {}) {
const book = createIconBook(null, { capabilities });
const pending = new Map();
const removed = new Set();
+ // Ids not drawn whatever their item says: following the clock, the time
+ // drawn is before the contact was there (`setUnseen`).
+ const unseen = new Set();
+ /** The item as the draw set takes it: hidden while unseen. */
+ const drawnItem = (item) =>
+ unseen.has(item.id) && item.show !== false
+ ? { ...item, show: false }
+ : item;
// The ids the draw set holds.
const sent = new Set();
let queued = false;
@@ -157,7 +167,7 @@ export function createContactIcons(drawSet = null, { capabilities } = {}) {
return p && result ? copyInto(p, result) : p;
},
course: (id, t) => book.course(id, t),
- shown: (id) => book.item(id)?.show !== false,
+ shown: (id) => book.item(id)?.show !== false && !unseen.has(id),
focus: (id) => book.focus(id),
alpha: (id) => book.item(id)?.alpha ?? 1,
scale: (id) => book.item(id)?.scale ?? 1,
@@ -165,7 +175,7 @@ export function createContactIcons(drawSet = null, { capabilities } = {}) {
put(item, options) {
book.put(item, options);
removed.delete(item.id);
- pending.set(item.id, item);
+ pending.set(item.id, drawnItem(item));
schedule();
},
/**
@@ -190,10 +200,25 @@ export function createContactIcons(drawSet = null, { capabilities } = {}) {
return true;
},
setShown: (id, value) => icons.update(id, { show: value !== false }),
+ /**
+ * Keep an id from being drawn (true) whatever its item's `show` says, or
+ * draw it as its item says again (false).
+ */
+ setUnseen(id, value) {
+ const item = book.item(id);
+ if (!item || unseen.has(id) === Boolean(value)) return;
+ if (value) unseen.add(id);
+ else unseen.delete(id);
+ pending.set(id, drawnItem(item));
+ schedule();
+ },
+ /** Whether an id is kept from being drawn (`setUnseen`). */
+ unseen: (id) => unseen.has(id),
setFocus: (id, factor) => icons.update(id, { focus: factor }),
remove(id) {
if (!book.has(id)) return;
book.remove(id);
+ unseen.delete(id);
pending.delete(id);
if (sent.has(id)) {
removed.add(id);
@@ -202,6 +227,7 @@ export function createContactIcons(drawSet = null, { capabilities } = {}) {
},
clear() {
for (const id of book.ids()) book.remove(id);
+ unseen.clear();
pending.clear();
removed.clear();
sent.clear();
@@ -211,6 +237,7 @@ export function createContactIcons(drawSet = null, { capabilities } = {}) {
flush,
dispose() {
for (const id of book.ids()) book.remove(id);
+ unseen.clear();
pending.clear();
removed.clear();
sent.clear();
@@ -438,6 +465,16 @@ export function createAircraftIcons({
let liveSet = null;
let sceneClock = false;
let sentDelayMs = NaN;
+ // The `recede` the set was last sent.
+ let sentRecede = null;
+ /**
+ * From when (display ms) each planned row's motion holds: a row whose
+ * motion starts after the time drawn is planned again when the time moves
+ * back before it (`_replanExpired`).
+ */
+ const planFrom = new Map();
+ /** The display time the rows were last checked against. */
+ let replannedAt = -Infinity;
/** The motion clock for whether the layer follows the world clock. */
const motionClock = (scene) =>
@@ -464,15 +501,27 @@ export function createAircraftIcons({
liveSet.setOptions({ motionClock: motionClock(scene) });
}
+ /** The set recedes by the aircraft tuning: sent again when it changes. */
+ function _syncRecede() {
+ if (!liveSet) return;
+ const recede = aircraftRecedeSpec();
+ if (recede === sentRecede) return;
+ sentRecede = recede;
+ liveSet.setOptions({ recede });
+ }
+
/**
- * Create the draw set for one layer lifetime, drawn over depth and culled
- * at the horizon on the delayed live clock, stacked by the sprite order.
+ * Create the draw set for one layer lifetime, drawn over depth, culled at
+ * the horizon and receding toward the limb on the delayed live clock,
+ * stacked by the sprite order.
* @returns {string} The set's id.
*/
function _createIcons(viewer) {
+ sentRecede = aircraftRecedeSpec();
const set = drawOf(viewer).icons({
id: `${layerId}-icons:${++instances}`,
horizonCull: true,
+ recede: sentRecede,
motionClock: motionClock(followsClock()),
drawOrder: services.sprites?.spriteDrawOrder?.(layerId) ?? 0,
});
@@ -494,6 +543,8 @@ export function createAircraftIcons({
state._icons?.dispose();
state._icons = null;
liveSet = null;
+ planFrom.clear();
+ replannedAt = -Infinity;
}
/** The near-image switch in CSS px for the scene's pixel ratio. */
@@ -553,11 +604,16 @@ export function createAircraftIcons({
* oldest fix, or the coast arc past the newest. The displayed nose glides
* from where it is onto the new course at the fleet's slew cap; a hovering
* contact keeps its nose. The item expires when the regime would change.
+ * Following the clock, a contact not there yet at the time drawn
+ * (`regime.unseen`) is not drawn until its warm-up begins.
* @param {string} icao24
- * @param {{fromCourseDeg?: number|null}} [options] Nose to glide from when
- * the row's own motion is not what was on screen (tracking handoff).
+ * @param {{fromCourseDeg?: number|null, rewound?: boolean}} [options]
+ * `fromCourseDeg`: nose to glide from when the row's own motion is not
+ * what was on screen (tracking handoff). `rewound`: the time drawn moved
+ * back before the row's motion; it is drawn where it was then, with no
+ * easing from where it is drawn now.
*/
- function _planIcon(icao24, { fromCourseDeg } = {}) {
+ function _planIcon(icao24, { fromCourseDeg, rewound = false } = {}) {
const icons = state._icons;
if (!icons?.has(icao24) || holdsPlan(icao24)) return;
const history = state._positionHistory.get(icao24);
@@ -575,11 +631,31 @@ export function createAircraftIcons({
if (_planPlaced(icao24, info, history, t)) return;
const regime = parts.motion._motionRegime(history, info, renderTime);
+ if (regime.unseen) {
+ // Held at its first fix, not drawn, until its warm-up begins.
+ const course = regime.heading;
+ icons.setUnseen(icao24, true);
+ icons.update(
+ icao24,
+ {
+ pos: clone(regime.fix.position),
+ course,
+ motion: { kind: 'hold', courseDeg: course },
+ courseGlide: undefined,
+ },
+ { expiresAt: fixMs(regime.fix) - TIMELINE_UNSEEN_MS },
+ );
+ planFrom.set(icao24, -Infinity);
+ return;
+ }
+ icons.setUnseen(icao24, false);
let speed;
let motion;
let pos;
let course;
let expiresAt = Infinity;
+ // From when the motion holds: before it, the time drawn has moved back.
+ let validFrom = t;
if (regime.kind === 'between' && regime.piece) {
// Along the curve between the two reports, a piece at a time.
const segment = regime.piece.segment;
@@ -588,6 +664,7 @@ export function createAircraftIcons({
pos = clone(segment.fix);
course = motionCourse(motion, undefined, t);
expiresAt = regime.piece.t1;
+ validFrom = regime.piece.t0;
} else if (regime.kind === 'between') {
const { a, b, span, trackFrom, trackTo, chordCourse } = regime;
speed = regime.speed;
@@ -609,10 +686,19 @@ export function createAircraftIcons({
motion = { kind: 'hold', courseDeg: course };
}
expiresAt = fixMs(b);
+ validFrom = fixMs(a);
} else {
const { fix, heading } = regime;
speed = regime.speed;
const t0 = fixMs(fix);
+ // A warm-up runs back to its start (a contact following the clock on
+ // its own fixes is unseen before that); a coast holds from its fix.
+ validFrom =
+ regime.maxDt === 0 && t0 > t
+ ? history[0].timeline === true
+ ? t0 - TIMELINE_UNSEEN_MS
+ : -Infinity
+ : t0;
pos = clone(fix.position);
course = heading;
motion =
@@ -643,6 +729,7 @@ export function createAircraftIcons({
motion = floored.motion;
pos = floored.pos;
course = floored.course;
+ validFrom = t;
}
expiresAt = Math.min(expiresAt, floored.expiresAt);
}
@@ -656,6 +743,7 @@ export function createAircraftIcons({
// whose motion ran out long ago, is simply drawn where it is now).
if (
fromCourseDeg == null &&
+ !rewound &&
icons.shown(icao24) &&
icons.expires(icao24) > t - RECOVER_STALE_PLAN_MS
) {
@@ -680,6 +768,7 @@ export function createAircraftIcons({
pos = clone(drawn);
course = motionCourse(motion, undefined, t);
expiresAt = end;
+ validFrom = t;
}
}
// Below hover speed the nose holds what is on screen (or, for a new row,
@@ -703,6 +792,7 @@ export function createAircraftIcons({
};
}
icons.update(icao24, { pos, course, motion, courseGlide }, { expiresAt });
+ planFrom.set(icao24, validFrom);
}
/**
@@ -735,16 +825,27 @@ export function createAircraftIcons({
courseSlopeDeg: norm180(end.courseDeg - course),
}
: { kind: 'hold', courseDeg: course };
+ state._icons.setUnseen(icao24, false);
state._icons.update(
icao24,
{ pos: clone(from), course, motion, courseGlide: undefined },
{ expiresAt: t1 },
);
+ planFrom.set(icao24, t);
return true;
}
- /** Re-plan every row whose regime ended by `t` (epoch ms). */
+ /**
+ * Re-plan every row whose regime ended by `t` (epoch ms), and, following
+ * the clock, every row whose motion starts after `t` once the time drawn
+ * moved back (a seek, or the clock run backward): it is drawn where it was
+ * then, as it is when the time moves on.
+ */
function _replanExpired(t) {
+ if (followsClock() && t < replannedAt)
+ for (const [icao24, from] of planFrom)
+ if (from > t) _planIcon(icao24, { rewound: true });
+ replannedAt = t;
for (const icao24 of state._icons.due(t)) _planIcon(icao24);
}
@@ -889,6 +990,7 @@ export function createAircraftIcons({
/** Drop a contact and everything the layer keeps for it. */
function _forgetContact(icao24) {
state._icons?.remove(icao24);
+ planFrom.delete(icao24);
parts.rendering._releaseModel(icao24);
state.records.forget(icao24);
// The host-supplied placement, if any, forgets it as well.
@@ -907,6 +1009,7 @@ export function createAircraftIcons({
return {
_displayMs,
_syncMotionClock,
+ _syncRecede,
_createIcons,
_disposeIcons,
_syncImageSwitch,
@@ -930,8 +1033,8 @@ export function createAircraftIcons({
/**
* A contact's icon item before it is styled or planned: held at the origin
- * (as a fresh row of the icon set was), always drawn over depth, receding
- * toward the limb, picked as `{layer, id}`. Its image comes with its style
+ * (as a fresh row of the icon set was), always drawn over depth (receding
+ * toward the limb, as its set does), picked as `{layer, id}`. Its image comes with its style
* (`_applyIconPresentation`), before the item is first written.
*/
function baseContactItem(layerId, icao24, show) {
@@ -942,7 +1045,6 @@ function baseContactItem(layerId, icao24, show) {
course: 0,
size: [FLEET_ICON_SIZE_PX, FLEET_ICON_SIZE_PX],
rotationMode: 'course',
- recede: true,
disableDepthTest: Infinity,
focus: 1,
show,
diff --git a/src/data/aircraftModelLayer.js b/src/data/aircraftModelLayer.js
index 4344f9eeb..b601b3179 100644
--- a/src/data/aircraftModelLayer.js
+++ b/src/data/aircraftModelLayer.js
@@ -787,6 +787,9 @@ export function createAircraftModels({
// clock. (The tracked trail moves on in its own pass before each frame.)
if (state._viewer) parts.tracking._staleCueTick?.();
try {
+ // Every frame too: the icons recede by the tuning as it is now, so a
+ // change shows on the next frame, shown or not.
+ parts.icons._syncRecede?.();
_fleetPass();
} finally {
// The models first, then the icons they take over from, so a pass
@@ -921,9 +924,13 @@ export function createAircraftModels({
if (icao24 === state._trackedIcao) continue;
if (!icons.has(icao24)) continue;
const position = icons.position(icao24, t);
- if (!parts.icons._aboveHorizon(position, occluder)) {
+ if (
+ icons.unseen?.(icao24) ||
+ !parts.icons._aboveHorizon(position, occluder)
+ ) {
// A model that crossed the limb would keep drawing through the
- // hidden globe; the icon's own cull is on the GPU.
+ // hidden globe; the icon's own cull is on the GPU. A contact not
+ // there yet at the time drawn is hidden as one beyond it.
const hidden = state._models.get(icao24);
if (hidden?.show) {
showModel(hidden, false);
diff --git a/src/data/aircraftModelLayer.test.mjs b/src/data/aircraftModelLayer.test.mjs
index 82a90fda2..5db4baa4c 100644
--- a/src/data/aircraftModelLayer.test.mjs
+++ b/src/data/aircraftModelLayer.test.mjs
@@ -84,6 +84,9 @@ function fleetFixture(positions) {
},
});
const shown = new Map([...positions.keys()].map((id) => [id, true]));
+ let alphaOf = 1;
+ let focusOf = 1;
+ const unseenIds = new Set();
const icons = {
show: true,
setId: 'flights-icons:1',
@@ -91,9 +94,10 @@ function fleetFixture(positions) {
has: (id) => positions.has(id),
position: (id) => positions.get(id),
course: () => 90,
- alpha: () => 1,
- focus: () => 1,
+ alpha: () => alphaOf,
+ focus: () => focusOf,
setShown: (id, value) => shown.set(id, value),
+ unseen: (id) => unseenIds.has(id),
flush() {},
};
const state = {
@@ -116,6 +120,7 @@ function fleetFixture(positions) {
},
};
let now = 1_000_000;
+ let iconRecedeSyncs = 0;
const parts = {
icons: {
_displayMs: () => now,
@@ -124,6 +129,9 @@ function fleetFixture(positions) {
_focusIcons() {},
_occluder: () => null,
_aboveHorizon: () => true,
+ _syncRecede() {
+ iconRecedeSyncs += 1;
+ },
},
motion: { _displayTimeAt: () => null },
tracking: {
@@ -157,6 +165,18 @@ function fleetFixture(positions) {
removes,
shown,
failNextUpsert: () => (failNextUpsert = true),
+ /** How often the icons were told to recede by the tuning as it is now. */
+ iconRecedeSyncs: () => iconRecedeSyncs,
+ /** Mark a contact as not there yet at the time drawn, or there again. */
+ setUnseen(id, value) {
+ if (value) unseenIds.add(id);
+ else unseenIds.delete(id);
+ },
+ /** The icons' alpha and focus the fleet models take. */
+ look(alpha, focus) {
+ alphaOf = alpha;
+ focusOf = focus;
+ },
/** One fleet tick, past the tick interval. */
tick() {
now += 1000;
@@ -296,3 +316,76 @@ test('a fleet model whose load failed is loaded again after a wait, not before',
Date.now = realNow;
}
});
+
+test('fleet model alpha is worked out once a fleet tick from the camera then, as base × max(floor, focus × haze); the IR boost draws full strength', async () => {
+ const {
+ aircraftTreatmentAlpha,
+ setAircraftRecessionParams,
+ resetAircraftRecessionParams,
+ } = await import('./aircraftRecession.js');
+ const position = near(1);
+ const f = fleetFixture(new Map([['a1', position]]));
+ assert.equal(f.fleet().spec.recede ?? null, null, 'the set does not recede');
+ const eye = fromDegrees(-97.71, 30.21, 30_000);
+ const expected = (focusFactor) =>
+ aircraftTreatmentAlpha({
+ baseAlpha: 0.8,
+ focusFactor,
+ cameraDistanceM: Math.hypot(
+ eye.x - position.x,
+ eye.y - position.y,
+ eye.z - position.z,
+ ),
+ cameraHeightM: 30_000,
+ });
+ try {
+ // Recede from the eye on, so the haze is not 1 here.
+ setAircraftRecessionParams({ startLimbRatio: 0, alphaFloor: 0.05 });
+ f.look(0.8, 0.5);
+ f.tick();
+ f.draw.ready(f.fleetId, 'a1');
+ f.tick();
+ const item = f.fleet().items.get('a1');
+ assert.equal(item.tint[3], expected(0.5), 'the tint carries it all');
+ assert.equal(item.focus ?? 1, 1, 'with no focus for the set to compose');
+ // A frame inside the fleet interval writes nothing, whatever changed.
+ f.look(0.8, 0.25);
+ f.models._fleetTick();
+ assert.equal(f.fleet().items.get('a1').tint[3], item.tint[3]);
+ f.tick();
+ assert.equal(
+ f.fleet().items.get('a1').tint[3],
+ expected(0.25),
+ 'the next tick takes it',
+ );
+ } finally {
+ resetAircraftRecessionParams();
+ }
+ f.state._irBoost = true;
+ f.models._reloadModelsForIrBoost();
+ f.tick();
+ assert.equal(f.fleet().items.get('a1').tint[3], 1, 'boosted: full strength');
+});
+
+test('a tuning change reaches the icons on the next frame, icons shown or not', async () => {
+ const f = fleetFixture(new Map([['a1', near(1)]]));
+ f.state._icons.show = false;
+ const before = f.iconRecedeSyncs();
+ f.models._fleetTick();
+ assert.ok(f.iconRecedeSyncs() > before, 'the icons are told');
+});
+
+test('a contact not there yet at the time drawn has its fleet model hidden, as one beyond the horizon', () => {
+ const f = fleetFixture(new Map([['a1', near(1)]]));
+ f.tick();
+ f.draw.ready(f.fleetId, 'a1');
+ f.tick();
+ assert.equal(f.fleet().items.get('a1').show, true, 'drawn while there');
+ f.setUnseen('a1', true);
+ f.tick();
+ assert.equal(f.fleet().items.get('a1').show, false, 'hidden while unseen');
+ f.setUnseen('a1', false);
+ f.tick();
+ f.tick();
+ assert.equal(f.fleet().items.get('a1').show, true, 'drawn again');
+});
diff --git a/src/data/aircraftMotionRegime.js b/src/data/aircraftMotionRegime.js
index 9c1d09b7f..5594ca20a 100644
--- a/src/data/aircraftMotionRegime.js
+++ b/src/data/aircraftMotionRegime.js
@@ -8,6 +8,7 @@ import {
} from '../geo/julian.js';
import { clone, distance } from '../geo/vector.js';
import { curvePieceAt, fixCurveCached } from './fixCurve.js';
+import { historyBracketIndex, historyUnseenAt } from './timelineHistory.js';
import {
COAST_MAX_SPEED_MPS,
courseBetweenCartesians,
@@ -136,6 +137,7 @@ export function createMotionRegime() {
turnRateDps: 0,
minDt: 0,
maxDt: 0,
+ unseen: false,
};
}
@@ -164,7 +166,9 @@ export function createMotionRegime() {
* five minutes past it, then stops (SIGNAL LOST). A contact last heard on
* or near the ground holds there instead (`staleHoldsForFix`, decided once
* per report), and a chain of synthetic fixes never coasts further than
- * the real report they were built from would.
+ * the real report they were built from would. Following the clock, a
+ * warm-up well before a contact's own first fix is `unseen`: it was not
+ * there yet, and is not drawn (`historyUnseenAt`).
*
* @param {Array