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
+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) => {
|
||||
|
||||
Reference in new issue
Block a user