Draw the last native world labels through the label overlay

The Directions A and B letters and a data pack's media label were the two
Cesium text labels left, kept by an allow-list in noCesiumLabels.test.mjs.
Both now publish entries to the shared world-overlay host, and the
allow-list is gone, so any Cesium label in src is a test failure.

Directions publishes the letters to the directions-markers source; the
markers keep only their points. A clicked endpoint's letter hangs over the
surface that was clicked. One placed without a click stays hidden until its
ground-floor cell resolves, then requests a render, so a still camera shows
it; a cell that settles with no height falls back to the ellipsoid. Each
position is computed once.

A pack resource handle gains label(entry). The application passes its
shared overlay host to SceneDirector through dataPacks.overlayHost; without
one a media pack fails to load rather than drawing a native label. Each
labelled resource takes a source from a pool and returns it on dispose, as
the host never removes a source, so two presentations of one pack never
clear each other's labels and repeat loads add no sources. A label written
after dispose is ignored. The media label is protected, so it always draws
as before.

Live (Denver, keyless globe): a clicked A and a programmatic B both anchor
on their dots over 1.58 km ground. Documented in docs/CURRENT-STATE.md and
docs/DIRECTOR-DATA-PACKS.md.
This commit is contained in:
Sameh Khamis committed 2026-11-04 12:30:31 -08:00
1 parent 18d6e3292d
commit 464c29a9ed
12 files changed
+382 -44

No files matched your search

+1 -14
View File
@@ -4,11 +4,6 @@ import { readdirSync, readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { parsers } from 'prettier/plugins/babel.mjs';
// Existing entity graphics only. Remove entries as these callers migrate.
const legacyFiles = new Set([
'src/scenes/dataPacks/presentation.js',
'src/layers/directions/index.js',
]);
const root = fileURLToPath(new URL('../', import.meta.url));
const propertyName = (node) => node?.name ?? node?.value;
const memberName = (node) =>
@@ -110,7 +105,6 @@ function cesiumLabels(source) {
test('runtime world text uses the world-overlay host, never new Cesium labels', () => {
const violations = [];
const legacySeen = new Set();
function scan(directory) {
for (const entry of readdirSync(root + directory, {
withFileTypes: true,
@@ -123,9 +117,7 @@ test('runtime world text uses the world-overlay host, never new Cesium labels',
!/\.(?:test|spec)\.js$/.test(entry.name)
) {
const hits = cesiumLabels(readFileSync(root + file, 'utf8'));
if (!hits.length) continue;
if (legacyFiles.has(file)) legacySeen.add(file);
else violations.push(...hits.map((hit) => `${file}:${hit}`));
violations.push(...hits.map((hit) => `${file}:${hit}`));
}
}
}
@@ -135,11 +127,6 @@ test('runtime world text uses the world-overlay host, never new Cesium labels',
[],
`Cesium text labels are forbidden; use the world-overlay host.\n${violations.join('\n')}`,
);
assert.deepEqual(
legacySeen,
legacyFiles,
'Remove stale or false-positive Cesium-label exceptions',
);
});
test('the guard catches label APIs and entity graphics, including aliases and multiline options', () => {