The renderer seam: clicks go to the newest tool, recession and display groups through the contract, drawing at parity with Cesium

- Clicks: when two tools want the globe's clicks, the newest takes them and the older is told and turns itself off; a click is decided when it arrives, and ambient selection fires only when no tool holds the pointer. The "map is busy" paths and their strings are removed.
- Recession: the limb fade is shared (src/render/recession.js) and reaches icon and model sets through SetSpec.recede; tuning applies on the next frame.
- Display panel groups are published through src/ui/displayGroups.js; the Weather group and src/viewWeather.js are removed.
- Draw port: a set whose icons only move is moved in place, and models that did not change are not restyled each frame, so moving fleets cost what they did when drawn directly; an untinted, fully opaque model is drawn without a colour.
- Conformance: input.lease.lost checks the new lease inside onLost and reports a throwing onLost; draw.sets.recede covers model sets.
- QA scripts read the renderer host instead of internals the seam replaced.
This commit is contained in:
Sameh Khamis committed 2026-11-15 17:03:09 -08:00
1 parent a0d299523d
commit 0ab31d4fb8
130 files changed
+5438 -1674

No files matched your search

+93 -1
View File
@@ -2,7 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import { inputFor, pickAt } from './dispatcher.js';
import { bindRenderer } from '../render/rendererOf.js';
import { bindRenderer, findInput } from '../render/rendererOf.js';
import {
FAKE_EVENT_TYPES,
FakeScreenSpaceEventHandler as FakeHandler,
@@ -193,6 +193,98 @@ test('a stale lease gets nothing once its successor holds the pointer', (t) => {
assert.equal(staleRan, 0);
});
test("a tool's claim holds the renderer's input port without taking its presses", (t) => {
const h = harness();
t.after(() => h.input.destroy());
const port = findInput(h.viewer);
const heard = [];
port.on('click', () => heard.push('port'));
const lease = claimPointer('test-tool');
t.after(() => releasePointer(lease));
h.input.onPointer('click', () => heard.push('tool'), { lease });
assert.equal(port.isPointerFree(), false);
h.click();
// Who hears a click is decided here, when it arrives; the port gives
// every press on, so the renderer's own select runs unless held off.
assert.deepEqual(heard, ['tool', 'port']);
releasePointer(lease);
assert.equal(port.isPointerFree(), true);
h.click();
assert.deepEqual(heard, ['tool', 'port', 'port']);
});
test('a click goes where the pointer is when it arrives: a tool that claims during the press gets it, ambient selection does not', (t) => {
const h = harness();
t.after(() => h.input.destroy());
const heard = [];
h.input.onClick(() => heard.push('ambient'));
let lease = null;
h.input.onPointer('click', () => heard.push('tool'), {
lease: () => lease,
});
h.input.onPointer('dblclick', () => heard.push('tool:dblclick'), {
lease: () => lease,
});
h.input.onPointer('dblclick', () => heard.push('ambient:dblclick'));
h.handler.fire(TYPES.LEFT_DOWN, { position: { x: 10, y: 10 } });
lease = claimPointer('test-tool');
t.after(() => releasePointer(lease));
h.handler.fire(TYPES.LEFT_UP, { position: { x: 10, y: 10 } });
h.handler.fire(TYPES.LEFT_CLICK, { position: { x: 10, y: 10 } });
h.handler.fire(TYPES.LEFT_DOUBLE_CLICK, { position: { x: 10, y: 10 } });
assert.deepEqual(heard, ['tool', 'tool:dblclick']);
});
test('a click goes where the pointer is when it arrives: after a tool lets go during the press, ambient selection gets it', (t) => {
const h = harness();
t.after(() => h.input.destroy());
const heard = [];
h.input.onClick(() => heard.push('ambient'));
const lease = claimPointer('test-tool');
t.after(() => releasePointer(lease));
h.input.onPointer('click', () => heard.push('tool'), { lease });
h.input.onPointer('dblclick', () => heard.push('ambient:dblclick'));
h.handler.fire(TYPES.LEFT_DOWN, { position: { x: 10, y: 10 } });
releasePointer(lease);
h.handler.fire(TYPES.LEFT_UP, { position: { x: 10, y: 10 } });
h.handler.fire(TYPES.LEFT_CLICK, { position: { x: 10, y: 10 } });
h.handler.fire(TYPES.LEFT_DOUBLE_CLICK, { position: { x: 10, y: 10 } });
assert.deepEqual(heard, ['ambient', 'ambient:dblclick']);
});
test("a claim on the renderer's port takes over from the tool, which is told", (t) => {
const h = harness();
t.after(() => h.input.destroy());
const port = findInput(h.viewer);
const told = [];
const heard = [];
const lease = claimPointer('test-tool', { onLost: () => told.push('tool') });
h.input.onPointer('click', () => heard.push('tool'), { lease });
h.input.onClick(() => heard.push('ambient'));
const other = port.claimPointer('other');
t.after(() => other.release());
port.on('click', () => heard.push('other'), { lease: other });
assert.deepEqual(told, ['tool']);
h.click();
assert.deepEqual(
heard,
['other'],
'neither the old tool nor ambient selection',
);
releasePointer(lease);
assert.equal(other.current, true, "the old tool's release frees nothing");
});
test('destroy gives the port its lease back', () => {
const h = harness();
const port = findInput(h.viewer);
const lease = claimPointer('test-tool');
assert.equal(port.isPointerFree(), false);
h.input.destroy();
assert.equal(port.isPointerFree(), true);
releasePointer(lease);
});
test('camera input returns only when the last hold releases', (t) => {
const h = harness();
t.after(() => h.input.destroy());