mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Show the renderer's credits in the application's own line
- On a renderer whose plugin does not show its credits in a display of its own (the ownCreditDisplay hook; Cesium's does), the application shows what the credits port lists at the bottom left (#gev-credits): inline credits on the line, the rest, the layers' data credits among them, in the Data attribution list it opens. The button and list are keyboard operable; Escape closes the list and returns focus. Text is set as text; links and logos keep only safe schemes. - The panel, Cockpit and overlay layouts keep clear of it as of Cesium's. - The stub boot check fails when the credits line is not shown or its list is empty; it keeps its report when the run stops early, counts only the dev server's providers and other origins as feeds, and a failed default renderer load is retried without dropping a newer one.
This commit is contained in:
1 parent
691cb0cd79
commit
16c7034c28
15 files changed
+411
-18
No files matched your search
@@ -6888,11 +6888,19 @@ renderer's own objects: the record of files that still did,
|
||||
shown.
|
||||
- The renderer follows its container's size (`Renderer.resize`, from a
|
||||
`ResizeObserver`).
|
||||
- The credits: the Cesium renderer's plugin says it shows them in a display
|
||||
its own (`ownCreditDisplay`; Cesium's `#cesium-credits`) keeps it. On any
|
||||
other, the application shows what the credits port lists in its own line
|
||||
at the bottom left (`#gev-credits`, `src/ui/creditsView.js`): the inline
|
||||
credits on the line, the rest (the layers' data credits among them) in
|
||||
the "Data attribution" list it opens, a keyboard button with Escape to
|
||||
close.
|
||||
|
||||
`npm run qa:stub-boot` boots the whole application on the stub with only
|
||||
the contract's required members (`dev/stub-app/main.js`, served in place of
|
||||
`src/main.js` on the application's own page), headless. It fails if
|
||||
Cesium's code is requested (the one stylesheet `vite-plugin-cesium` links
|
||||
the credits line is not shown or its list is empty, if Cesium's code is
|
||||
requested (the one stylesheet `vite-plugin-cesium` links
|
||||
into every page is reported), on any page or console error, or if a data
|
||||
layer (flights, transit, traffic, CCTV, AIS vessels, weather radar and
|
||||
satellite, wind, satellites, FIRMS, wildlife) fails to turn on or off. A
|
||||
|
||||
@@ -217,7 +217,10 @@ on (no `renderer.id`, no engine type, no engine object's presence).
|
||||
`provideApplicationHooks(renderer, hooks)` (`src/render/applicationHooks.js`),
|
||||
each hook optional and used only where given: a map engine of its own,
|
||||
stale command trimming, inline panel rendering, whether an entity is its
|
||||
own, the zoom-out guard, and what QA scripts read from
|
||||
own, the zoom-out guard, whether it shows its credits in a display of
|
||||
its own (`ownCreditDisplay`; otherwise the application's own line,
|
||||
`src/ui/creditsView.js`, shows the credits port's list), and what QA
|
||||
scripts read from
|
||||
`window.__godsEyeView` (Cesium's viewer there, for the scripts that drive
|
||||
it). None is a contract member, and a renderer without them runs the
|
||||
application without that behaviour.
|
||||
@@ -227,7 +230,8 @@ on (no `renderer.id`, no engine type, no engine object's presence).
|
||||
- **The proof.** `npm run qa:stub-boot` (`scripts/qa-stub-boot.mjs`) serves
|
||||
the application's page with `dev/stub-app/main.js` as its entry: the whole
|
||||
application on the stub with no capability at all. It fails when the page
|
||||
requests any Cesium module or asset, on a page or console error, or when a
|
||||
requests any Cesium module or asset, when the credits line is not shown
|
||||
with its data credits, on a page or console error, or when a
|
||||
data layer (flights, transit, traffic, CCTV, vessels, weather, wind,
|
||||
satellites, FIRMS, wildlife) fails to turn on or off; `--strict` also fails
|
||||
a layer that draws nothing on the stub (it needs the live feeds).
|
||||
|
||||
@@ -1451,5 +1451,7 @@
|
||||
"src/render/cesium/viewers.js",
|
||||
"src/app/scene.test.mjs",
|
||||
"dev/stub-app/main.js",
|
||||
"scripts/qa-stub-boot.mjs"
|
||||
"scripts/qa-stub-boot.mjs",
|
||||
"src/ui/creditsView.js",
|
||||
"src/ui/creditsView.test.mjs"
|
||||
]
|
||||
@@ -4573,7 +4573,8 @@
|
||||
"src/render/cesium/imageryLookAhead.js",
|
||||
"src/render/applicationHooks.js",
|
||||
"src/maps/globeEngine.js",
|
||||
"src/render/cesium/viewers.js"
|
||||
"src/render/cesium/viewers.js",
|
||||
"src/ui/creditsView.js"
|
||||
],
|
||||
"external": [
|
||||
"hls.js",
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* - it starts, with no Cesium module requested at all (no script, no
|
||||
* worker, no asset it would fetch; the one Cesium stylesheet the build's
|
||||
* `vite-plugin-cesium` links into every page is reported, not failed);
|
||||
* - the credits show in the application's own line, and its list opens
|
||||
* with the data credits;
|
||||
* - each data layer named below turns on, and off, without a page error or
|
||||
* a console error (a feed's failed response is reported as the feed's,
|
||||
* not failed: without network access or keys a feed answers with an
|
||||
@@ -58,8 +60,22 @@ const isPluginStylesheet = (url, type) =>
|
||||
type === 'stylesheet' &&
|
||||
new URL(url).pathname === '/cesium/Widgets/widgets.css';
|
||||
|
||||
/** A browser's line for a response that failed: the feed's, not the page's. */
|
||||
const isFailedResponse = (text) => /^Failed to load resource:/.test(text);
|
||||
/**
|
||||
* A browser's line for a feed's response that failed: one of the dev
|
||||
* server's providers (`/api/`) or another origin's. The application's own
|
||||
* modules and assets failing are the page's.
|
||||
*/
|
||||
const isFailedResponse = (text, at, base) => {
|
||||
if (!/^Failed to load resource:/.test(text)) return false;
|
||||
try {
|
||||
const url = new URL(at);
|
||||
return (
|
||||
url.origin !== new URL(base).origin || url.pathname.startsWith('/api/')
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An error the dev server's own client logs (its socket to the server, which
|
||||
@@ -157,7 +173,7 @@ async function run(args) {
|
||||
const text = message.text();
|
||||
const at = message.location()?.url ?? null;
|
||||
errors.push({
|
||||
kind: isFailedResponse(text)
|
||||
kind: isFailedResponse(text, at, base)
|
||||
? 'response'
|
||||
: isDevClient(at)
|
||||
? 'tooling'
|
||||
@@ -215,6 +231,26 @@ async function run(args) {
|
||||
};
|
||||
});
|
||||
report.startupErrors = errors.slice();
|
||||
// The credits show in the application's own line, with no Cesium: the
|
||||
// line is on screen and its list opens with the data credits in it.
|
||||
report.credits = await page.evaluate(async () => {
|
||||
const line = document.getElementById('gev-credits');
|
||||
const expand = line?.querySelector('.gev-credits-expand');
|
||||
const panel = document.getElementById('gev-credits-panel');
|
||||
const box = line?.getBoundingClientRect();
|
||||
const visible =
|
||||
Boolean(box && box.width > 0 && box.height > 0) &&
|
||||
getComputedStyle(line).visibility !== 'hidden';
|
||||
expand?.click();
|
||||
await new Promise((resolve) => requestAnimationFrame(resolve));
|
||||
const listed =
|
||||
panel?.hidden === false ? panel.querySelectorAll('li').length : 0;
|
||||
expand?.click();
|
||||
return { visible, line: line?.textContent ?? null, listed };
|
||||
});
|
||||
console.log(
|
||||
`credits: ${report.credits.visible ? 'shown' : 'NOT shown'}; line "${report.credits.line}"; ${report.credits.listed} listed`,
|
||||
);
|
||||
const known = await page.evaluate(() =>
|
||||
window.__godsEyeView.dataManager.getAll().map((layer) => layer.id),
|
||||
);
|
||||
@@ -316,6 +352,9 @@ async function run(args) {
|
||||
);
|
||||
}
|
||||
report.ok = true;
|
||||
} catch (error) {
|
||||
// Reported with the rest below, so the report and errors are kept.
|
||||
report.failure = String(error?.stack || error);
|
||||
} finally {
|
||||
report.cesiumRequests = cesiumRequests;
|
||||
report.cesiumStylesheets = cesiumStylesheets;
|
||||
@@ -327,9 +366,15 @@ async function run(args) {
|
||||
const failedResponses = errors.filter((error) => error.kind === 'response');
|
||||
const toolingErrors = errors.filter((error) => error.kind === 'tooling');
|
||||
const problems = [];
|
||||
if (report.failure) problems.push(`the run stopped: ${report.failure}`);
|
||||
if (!report.started?.ok) problems.push('the application did not start');
|
||||
if (!report.renderer?.canvasInPage)
|
||||
problems.push("the stub's canvas is not in the page");
|
||||
if (
|
||||
report.started?.ok &&
|
||||
(!report.credits?.visible || !report.credits.listed)
|
||||
)
|
||||
problems.push('the credits line is not shown, or its list is empty');
|
||||
if (cesiumRequests.length)
|
||||
problems.push(`Cesium was requested: ${cesiumRequests.join(', ')}`);
|
||||
if (pageErrors.length) problems.push(`${pageErrors.length} page error(s)`);
|
||||
|
||||
+10
-4
@@ -1,5 +1,6 @@
|
||||
import { createApplicationOperations } from './operations.js';
|
||||
import { registerDataCredits } from '../data/dataCredits.js';
|
||||
import { mountCreditsView } from '../ui/creditsView.js';
|
||||
import { MapStackController } from '../mapStackController.js';
|
||||
import { mapEngineFor } from '../maps/engine.js';
|
||||
import { initLogoGaze } from '../logoGaze.js';
|
||||
@@ -28,15 +29,17 @@ let defaultLoad = null;
|
||||
* @returns {Promise<object>} The default `RendererPlugin`.
|
||||
*/
|
||||
export function loadDefaultRenderer() {
|
||||
defaultLoad ??= (async () => {
|
||||
if (defaultLoad) return defaultLoad;
|
||||
const load = (async () => {
|
||||
const { cesiumRenderer } = await import('../render/cesium/application.js');
|
||||
return cesiumRenderer;
|
||||
})();
|
||||
defaultLoad = load;
|
||||
// A load that failed is tried again by the next call.
|
||||
defaultLoad.catch(() => {
|
||||
defaultLoad = null;
|
||||
load.catch(() => {
|
||||
if (defaultLoad === load) defaultLoad = null;
|
||||
});
|
||||
return defaultLoad;
|
||||
return load;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,6 +133,9 @@ export async function createApplicationScene({
|
||||
}),
|
||||
);
|
||||
registerDataCredits(viewer, credits);
|
||||
// The credits, in the application's own line, unless the renderer shows
|
||||
// them in a display of its own.
|
||||
if (!hooks.ownCreditDisplay) defer(mountCreditsView(viewer));
|
||||
loaderStatus.textContent =
|
||||
googleApiKey || googleTokens || cesiumToken
|
||||
? t('Loading Google 3D Tiles...')
|
||||
|
||||
@@ -69,6 +69,15 @@ test('the scene runs on a renderer with only the required members', async (t) =>
|
||||
'Esri imagery through the port',
|
||||
);
|
||||
assert.equal(scene.mapStackController.getDrapeSurface(), 'globe');
|
||||
// The credits show in the application's own line: the Esri base's on it,
|
||||
// the data credits in the list it opens.
|
||||
const line = document.getElementById('gev-credits');
|
||||
assert.ok(line, 'a credits line');
|
||||
assert.match(line.textContent, /Esri/);
|
||||
assert.ok(
|
||||
document.querySelectorAll('#gev-credits-panel li').length > 10,
|
||||
'the data credits',
|
||||
);
|
||||
|
||||
// Switching stacks goes through the port too.
|
||||
await scene.mapStackController.setStack('osm');
|
||||
@@ -79,6 +88,7 @@ test('the scene runs on a renderer with only the required members', async (t) =>
|
||||
assert.equal(scene.viewer.isDestroyed(), true);
|
||||
assert.equal(rendererOf(scene.viewer), null, 'and lets go of the renderer');
|
||||
assert.equal(renderer.globe.imagery.list().length, 0, 'imagery released');
|
||||
assert.equal(document.getElementById('gev-credits'), null, 'credits gone');
|
||||
});
|
||||
|
||||
test('with credentials, the photoreal base loads through the globe port', async (t) => {
|
||||
|
||||
@@ -14,6 +14,7 @@ export const WORLD_OVERLAY_OCCLUDER_SELECTORS = Object.freeze([
|
||||
'#command-dock',
|
||||
'#gev-voice-control',
|
||||
'#cesium-credits',
|
||||
'#gev-credits',
|
||||
'.hud-top-left',
|
||||
'.hud-top-right',
|
||||
'.hud-bottom-left',
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
* - `installZoomOutGuard(options)`: keeps outward user zooms bounded and the
|
||||
* Earth framed; returns its disposer.
|
||||
* - `qaHandles`: values QA scripts read from `window.__godsEyeView`.
|
||||
* - `ownCreditDisplay`: true when the renderer shows its credits in a
|
||||
* display of its own; otherwise the application shows what its credits
|
||||
* port lists (`src/ui/creditsView.js`).
|
||||
*/
|
||||
|
||||
const hooks = new WeakMap();
|
||||
|
||||
@@ -169,6 +169,8 @@ export function createCesiumRendererPlugin({
|
||||
unbind = bindRenderer(viewer, renderer);
|
||||
provideApplicationHooks(renderer, {
|
||||
mapEngine: cesiumMapEngine,
|
||||
// Cesium's credit display (#cesium-credits) shows the credits.
|
||||
ownCreditDisplay: true,
|
||||
// Drops the draw commands the scene keeps after it stops drawing
|
||||
// them; run after a drawn frame (see sceneCommandRelease.js).
|
||||
trimStaleCommands: () => trimStaleSceneCommands(viewer.scene),
|
||||
|
||||
@@ -99,6 +99,7 @@ export function syncContextLayout() {
|
||||
let safeBottom = window.innerHeight - 24;
|
||||
for (const selector of [
|
||||
'#cesium-credits',
|
||||
'#gev-credits',
|
||||
'#command-dock',
|
||||
'#view-switcher',
|
||||
]) {
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* @module ui/creditsView
|
||||
* @description The attribution line, in the application's own DOM, for a
|
||||
* renderer that does not draw its own credit display: what the renderer's
|
||||
* credits port lists (its own credits, each base layer's, the layers' data
|
||||
* credits). Inline credits are shown on the line at the bottom left; the
|
||||
* rest are in the "Data attribution" list it opens. A credit is plain data
|
||||
* (`src/render/contract/credits.d.ts`): its text is set as text, and a link
|
||||
* or logo is kept only for a safe scheme.
|
||||
*/
|
||||
import { findCredits } from '../render/rendererOf.js';
|
||||
import { LINK_SCHEMES, LOGO_SCHEMES, safeUrl } from '../render/creditMarkup.js';
|
||||
import { onLocaleChange, t } from '../i18n/index.js';
|
||||
|
||||
const PANEL_ID = 'gev-credits-panel';
|
||||
|
||||
/** The credits once each, in order: the same text and link are one. */
|
||||
function distinct(list) {
|
||||
const seen = new Set();
|
||||
return list.filter((credit) => {
|
||||
const key = `${credit?.text ?? ''}\u0000${credit?.href ?? ''}`;
|
||||
if (!credit?.text || seen.has(key)) return false;
|
||||
seen.add(key);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/** One credit as DOM: its logo, then its text, linked when it has a link. */
|
||||
function creditElement(doc, credit) {
|
||||
const href = credit.href ? safeUrl(credit.href, LINK_SCHEMES) : null;
|
||||
const element = doc.createElement(href ? 'a' : 'span');
|
||||
element.className = 'gev-credit';
|
||||
if (href) {
|
||||
element.href = href;
|
||||
element.target = '_blank';
|
||||
element.rel = 'noopener';
|
||||
}
|
||||
const logo = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null;
|
||||
if (logo) {
|
||||
const image = doc.createElement('img');
|
||||
image.className = 'gev-credit-logo';
|
||||
image.src = logo;
|
||||
image.alt = credit.text;
|
||||
element.append(image);
|
||||
} else element.textContent = credit.text;
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show `viewer`'s renderer credits at the bottom left of `root`'s page.
|
||||
* @param {object} viewer The scene object, bound to its renderer.
|
||||
* @param {{root?: HTMLElement}} [options] Where the line goes (the body).
|
||||
* @returns {() => void} Removes it.
|
||||
*/
|
||||
export function mountCreditsView(viewer, { root = document.body } = {}) {
|
||||
const credits = findCredits(viewer);
|
||||
if (!credits || !root) return () => {};
|
||||
const doc = root.ownerDocument;
|
||||
const bar = doc.createElement('div');
|
||||
bar.id = 'gev-credits';
|
||||
bar.className = 'gev-credits';
|
||||
const line = doc.createElement('span');
|
||||
line.className = 'gev-credits-line';
|
||||
const expand = doc.createElement('button');
|
||||
expand.type = 'button';
|
||||
expand.className = 'gev-credits-expand';
|
||||
expand.setAttribute('aria-haspopup', 'dialog');
|
||||
expand.setAttribute('aria-controls', PANEL_ID);
|
||||
expand.setAttribute('aria-expanded', 'false');
|
||||
|
||||
const panel = doc.createElement('div');
|
||||
panel.id = PANEL_ID;
|
||||
panel.className = 'gev-credits-panel';
|
||||
panel.setAttribute('role', 'dialog');
|
||||
panel.hidden = true;
|
||||
const header = doc.createElement('div');
|
||||
header.className = 'gev-credits-header';
|
||||
const title = doc.createElement('span');
|
||||
title.className = 'gev-credits-title';
|
||||
title.id = `${PANEL_ID}-title`;
|
||||
panel.setAttribute('aria-labelledby', title.id);
|
||||
const close = doc.createElement('button');
|
||||
close.type = 'button';
|
||||
close.className = 'gev-credits-close';
|
||||
close.textContent = '×';
|
||||
header.append(title, close);
|
||||
const list = doc.createElement('ul');
|
||||
list.className = 'gev-credits-list';
|
||||
panel.append(header, list);
|
||||
bar.append(line, expand);
|
||||
root.append(bar, panel);
|
||||
|
||||
const label = () => {
|
||||
expand.textContent = t('Data attribution');
|
||||
title.textContent = t('Data provided by:');
|
||||
close.setAttribute('aria-label', t('Close data attribution'));
|
||||
};
|
||||
|
||||
const setOpen = (open, { focus = false } = {}) => {
|
||||
panel.hidden = !open;
|
||||
expand.setAttribute('aria-expanded', String(open));
|
||||
if (open) close.focus();
|
||||
else if (focus) expand.focus();
|
||||
};
|
||||
|
||||
const render = (all) => {
|
||||
const shown = distinct(Array.isArray(all) ? all : []);
|
||||
const inline = shown.filter((credit) => credit.inline);
|
||||
const listed = shown.filter((credit) => !credit.inline);
|
||||
line.replaceChildren();
|
||||
inline.forEach((credit, i) => {
|
||||
if (i) line.append(doc.createTextNode(' · '));
|
||||
line.append(creditElement(doc, credit));
|
||||
});
|
||||
if (inline.length && listed.length) line.append(doc.createTextNode(' · '));
|
||||
list.replaceChildren(
|
||||
...listed.map((credit) => {
|
||||
const item = doc.createElement('li');
|
||||
item.append(creditElement(doc, credit));
|
||||
return item;
|
||||
}),
|
||||
);
|
||||
expand.hidden = listed.length === 0;
|
||||
if (expand.hidden && !panel.hidden) setOpen(false);
|
||||
};
|
||||
|
||||
const onExpand = () => setOpen(panel.hidden);
|
||||
const onClose = () => setOpen(false, { focus: true });
|
||||
const onKey = (event) => {
|
||||
if (event.key !== 'Escape' || panel.hidden) return;
|
||||
event.preventDefault();
|
||||
setOpen(false, { focus: true });
|
||||
};
|
||||
expand.addEventListener('click', onExpand);
|
||||
close.addEventListener('click', onClose);
|
||||
panel.addEventListener('keydown', onKey);
|
||||
label();
|
||||
render(credits.list());
|
||||
const offChange = credits.on('change', render);
|
||||
const offLocale = onLocaleChange(label);
|
||||
return () => {
|
||||
offChange();
|
||||
offLocale();
|
||||
expand.removeEventListener('click', onExpand);
|
||||
close.removeEventListener('click', onClose);
|
||||
panel.removeEventListener('keydown', onKey);
|
||||
bar.remove();
|
||||
panel.remove();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mountCreditsView } from './creditsView.js';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
import { createStubRenderer } from '../render/stub/index.js';
|
||||
|
||||
function scene() {
|
||||
document.body.replaceChildren();
|
||||
const renderer = createStubRenderer();
|
||||
const viewer = {};
|
||||
bindRenderer(viewer, renderer);
|
||||
return { viewer, renderer };
|
||||
}
|
||||
|
||||
test("the renderer's credits show on the line, and the rest in the list it opens", () => {
|
||||
const { viewer, renderer } = scene();
|
||||
renderer.credits.addStatic({
|
||||
text: 'Google',
|
||||
href: 'https://maps.google.com',
|
||||
inline: true,
|
||||
});
|
||||
const off = mountCreditsView(viewer);
|
||||
const line = document.querySelector('#gev-credits .gev-credits-line');
|
||||
assert.equal(line.textContent, 'Google');
|
||||
assert.equal(line.querySelector('a').href, 'https://maps.google.com/');
|
||||
const expand = document.querySelector('.gev-credits-expand');
|
||||
assert.equal(expand.hidden, true, 'nothing to list yet');
|
||||
|
||||
const remove = renderer.credits.addStatic({ text: 'Wildlife: iNaturalist' });
|
||||
renderer.credits.addStatic({ text: 'Wildlife: iNaturalist' });
|
||||
renderer.credits.addStatic({ text: 'OSM', href: 'javascript:alert(1)' });
|
||||
assert.equal(expand.hidden, false);
|
||||
assert.equal(expand.textContent, 'Data attribution');
|
||||
const panel = document.getElementById('gev-credits-panel');
|
||||
assert.equal(panel.hidden, true);
|
||||
expand.click();
|
||||
assert.equal(panel.hidden, false);
|
||||
assert.equal(expand.getAttribute('aria-expanded'), 'true');
|
||||
const items = [...panel.querySelectorAll('li')].map((li) => li.textContent);
|
||||
assert.deepEqual(items, ['Wildlife: iNaturalist', 'OSM'], 'once each');
|
||||
assert.equal(panel.querySelector('li:last-child a'), null, 'unsafe link');
|
||||
|
||||
panel.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),
|
||||
);
|
||||
assert.equal(panel.hidden, true);
|
||||
assert.equal(document.activeElement, expand, 'focus goes back');
|
||||
|
||||
remove();
|
||||
assert.equal(
|
||||
[...panel.querySelectorAll('li')].length,
|
||||
2,
|
||||
'a duplicate still credits it',
|
||||
);
|
||||
off();
|
||||
assert.equal(document.getElementById('gev-credits'), null);
|
||||
assert.equal(document.getElementById('gev-credits-panel'), null);
|
||||
});
|
||||
|
||||
test('a viewer with no renderer shows no credits line', () => {
|
||||
document.body.replaceChildren();
|
||||
const off = mountCreditsView({});
|
||||
assert.equal(document.getElementById('gev-credits'), null);
|
||||
off();
|
||||
});
|
||||
@@ -27,6 +27,7 @@ const LEFT_STACK_OBSTACLE_SELECTOR = [
|
||||
'#cockpit-context',
|
||||
'#cesium-credits .cesium-credit-logoContainer',
|
||||
'#cesium-credits .cesium-credit-textContainer',
|
||||
'#gev-credits',
|
||||
'#location-bar',
|
||||
'#control-panel',
|
||||
'#gev-voice-control',
|
||||
@@ -58,6 +59,7 @@ const RIGHT_STACK_OBSTACLE_SELECTOR = [
|
||||
'#cockpit-signal-stream',
|
||||
'#cesium-credits .cesium-credit-logoContainer',
|
||||
'#cesium-credits .cesium-credit-textContainer',
|
||||
'#gev-credits',
|
||||
'#command-dock',
|
||||
'#gev-voice-control',
|
||||
'#world-timeline',
|
||||
@@ -342,12 +344,13 @@ export class PanelLayoutController {
|
||||
attributeFilter: ['class', 'data-variant'],
|
||||
});
|
||||
}
|
||||
const credits = document.getElementById('cesium-credits');
|
||||
if (credits) {
|
||||
this._leftStackMutationObserver.observe(credits, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
});
|
||||
for (const id of ['cesium-credits', 'gev-credits']) {
|
||||
const credits = document.getElementById(id);
|
||||
if (credits)
|
||||
this._leftStackMutationObserver.observe(credits, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+91
@@ -332,6 +332,97 @@ body.cockpit-mode #cockpit-cloud-effects.active {
|
||||
color: rgba(232, 234, 237, 0.7);
|
||||
}
|
||||
|
||||
/* The application's own attribution line (src/ui/creditsView.js), for a
|
||||
renderer without a credit display of its own: the same place and look. */
|
||||
#gev-credits {
|
||||
position: fixed;
|
||||
bottom: 36px;
|
||||
left: 36px;
|
||||
z-index: 90;
|
||||
max-width: 90vw;
|
||||
white-space: nowrap;
|
||||
pointer-events: auto;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
color: rgba(232, 234, 237, 0.55);
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
|
||||
}
|
||||
#gev-credits a,
|
||||
#gev-credits .gev-credits-expand {
|
||||
color: rgba(232, 234, 237, 0.7);
|
||||
}
|
||||
#gev-credits .gev-credit-logo {
|
||||
height: 14px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#gev-credits .gev-credits-expand {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
font: inherit;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
.gev-credits-panel {
|
||||
position: fixed;
|
||||
bottom: 60px;
|
||||
left: 36px;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 470px;
|
||||
max-width: calc(100vw - 2rem);
|
||||
max-height: min(70dvh, 36rem);
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(232, 234, 237, 0.2);
|
||||
border-radius: 6px;
|
||||
background: rgba(16, 18, 22, 0.94);
|
||||
color: rgba(232, 234, 237, 0.85);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
.gev-credits-panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
.gev-credits-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 14px 4px 20px;
|
||||
}
|
||||
.gev-credits-close {
|
||||
border: 0;
|
||||
background: none;
|
||||
color: inherit;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.gev-credits-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 4px 20px 14px 40px;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
line-height: 1.35;
|
||||
}
|
||||
.gev-credits-list > li {
|
||||
padding-bottom: 5px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.gev-credits-list a {
|
||||
color: rgba(232, 234, 237, 0.85);
|
||||
}
|
||||
@media (max-width: 575px) {
|
||||
.gev-credits-panel {
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
max-height: 100dvh;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cesium's stock attribution lightbox grows with every registered data source.
|
||||
Keep the title and close affordance fixed while the complete, unabridged
|
||||
credit list wraps and scrolls inside a compact panel. */
|
||||
|
||||
Reference in new issue
Block a user