Place the credits line where Cesium's is, and draw a logo in place of its text

- Every placement of Cesium's credit display (above the command dock, the
  Minimal HUD's corner, clean view and recording, the phone tab bar and an
  open sheet) has the same rule for the application's line; a test keeps
  each stylesheet's pairs together.
- A credit's logo is drawn in place of its text, which names it (the
  image's alt), as Cesium shows logo credits; the contract's Credit says
  so. Links open with noopener and noreferrer; a list that empties while
  focus is in it hands focus back to the line.
- A stack that stays after any failed switch (a tileset or imagery that
  fails to load, or a photoreal base that fails to come back) still falls
  back on its tile failures: the controller binds its listener again for
  that switch where it handles the failure.
This commit is contained in:
Sameh Khamis committed 2026-11-10 18:48:26 -08:00
1 parent 241c8dde64
commit 6a6967d1ad
8 files changed
+137 -24

No files matched your search

+43
View File
@@ -58,9 +58,52 @@ test("the renderer's credits show on the line, and the rest in the list it opens
assert.equal(document.getElementById('gev-credits-panel'), null);
});
test('a credit with a logo is drawn as the logo, named by its text', () => {
const { viewer, renderer } = scene();
renderer.credits.addStatic({
text: 'Google',
logoUrl: 'https://example.com/logo.png',
inline: true,
});
const off = mountCreditsView(viewer);
const credit = document.querySelector('#gev-credits .gev-credit');
const logo = credit.querySelector('img');
assert.equal(logo.src, 'https://example.com/logo.png');
assert.equal(logo.alt, 'Google', 'screen readers and copies keep the name');
assert.equal(credit.textContent, '', 'the logo stands in place of the text');
off();
});
test('a viewer with no renderer shows no credits line', () => {
document.body.replaceChildren();
const off = mountCreditsView({});
assert.equal(document.getElementById('gev-credits'), null);
off();
});
test('the credits line is placed wherever the renderer’s own display is', async () => {
const { readFileSync, readdirSync } = await import('node:fs');
const dir = new URL('./styles/', import.meta.url);
const missing = [];
for (const name of readdirSync(dir).filter((f) => f.endsWith('.css'))) {
const css = readFileSync(new URL(name, dir), 'utf8').replace(
/\/\*[\s\S]*?\*\//g,
'',
);
const parts = [...css.matchAll(/([^{};]+)\{/g)]
.map((match) => match[1].replace(/\s+/g, ' ').trim())
.filter((selector) => !selector.startsWith('@'))
.flatMap((selector) =>
selector.split(/,(?![^(]*\))/).map((part) => part.trim()),
);
// The display's own selectors, without its inner parts, each with the
// line's counterpart in the same stylesheet.
for (const part of parts)
if (
/#cesium-credits$/.test(part) &&
!parts.includes(part.replace('#cesium-credits', '#gev-credits'))
)
missing.push(`${name}: ${part}`);
}
assert.deepEqual(missing, []);
});