Application extras come from the renderer plugin; framing, occlusion and panel drawing are contract ports

A renderer plugin may supply applicationHooks(renderer) for what only its
renderer has (map engine, own credits, stale commands, QA handles). What every
renderer should do moves onto the contract: controls.keepEarthFramed (behind
the keepEarthFramed capability), query.occlusionTest (behind occlusionTest),
and panel drawing, which keepPanelRendering now does through resize and
frame.renderNow through the contract. renderNow throws when the frame fails to draw.

The Cesium port installs its zoom-out guard through keepEarthFramed (a setView
no longer cancels its turn) and answers occlusionTest with the scene's probe;
the stub answers it with a horizon test.
This commit is contained in:
Sameh Khamis committed 2026-11-10 21:17:56 -08:00
1 parent a755f63638
commit 619c19ea67
40 files changed
+737 -323

No files matched your search

+52 -17
View File
@@ -10,8 +10,12 @@ function fakeElement() {
dataset: {},
focused: false,
id: '',
setAttribute(name, value) { attributes.set(name, String(value)); },
getAttribute(name) { return attributes.get(name) ?? null; },
setAttribute(name, value) {
attributes.set(name, String(value));
},
getAttribute(name) {
return attributes.get(name) ?? null;
},
addEventListener(type, listener) {
if (!listeners.has(type)) listeners.set(type, []);
listeners.get(type).push(listener);
@@ -22,8 +26,12 @@ function fakeElement() {
target: this,
defaultPrevented: false,
propagationStopped: false,
preventDefault() { this.defaultPrevented = true; },
stopPropagation() { this.propagationStopped = true; },
preventDefault() {
this.defaultPrevented = true;
},
stopPropagation() {
this.propagationStopped = true;
},
...event,
};
for (const listener of listeners.get(type) || []) listener(dispatched);
@@ -33,8 +41,12 @@ function fakeElement() {
this.onclick?.();
this.dispatch('click');
},
focus() { this.focused = true; },
listenerCount(type) { return listeners.get(type)?.length || 0; },
focus() {
this.focused = true;
},
listenerCount(type) {
return listeners.get(type)?.length || 0;
},
};
}
@@ -48,7 +60,8 @@ function fixture() {
lightbox.parentElement = overlay;
const root = {
querySelector(selector) {
if (selector === '#cesium-credits .cesium-credit-expand-link') return expand;
if (selector === '#cesium-credits .cesium-credit-expand-link')
return expand;
if (selector === '.cesium-credit-lightbox') return lightbox;
return null;
},
@@ -72,8 +85,12 @@ test('Enter opens and closes attribution on initial keydown', () => {
const f = fixture();
let opened = 0;
let closed = 0;
f.expand.onclick = () => { opened++; };
f.close.onclick = () => { closed++; };
f.expand.onclick = () => {
opened++;
};
f.close.onclick = () => {
closed++;
};
configureCreditKeyboardAccess(f.root);
const openEvent = f.expand.dispatch('keydown', { key: 'Enter' });
assert.equal(openEvent.defaultPrevented, true);
@@ -91,8 +108,12 @@ test('Space opens and closes attribution only on key release', () => {
const f = fixture();
let opened = 0;
let closed = 0;
f.expand.onclick = () => { opened++; };
f.close.onclick = () => { closed++; };
f.expand.onclick = () => {
opened++;
};
f.close.onclick = () => {
closed++;
};
configureCreditKeyboardAccess(f.root);
const openDown = f.expand.dispatch('keydown', { key: ' ' });
@@ -118,7 +139,9 @@ test('Space opens and closes attribution only on key release', () => {
test('held activation keys do not repeat open or close actions', () => {
const f = fixture();
let opened = 0;
f.expand.onclick = () => { opened++; };
f.expand.onclick = () => {
opened++;
};
configureCreditKeyboardAccess(f.root);
f.expand.dispatch('keydown', { key: ' ' });
@@ -132,7 +155,9 @@ test('held activation keys do not repeat open or close actions', () => {
const g = fixture();
let enterOpened = 0;
g.expand.onclick = () => { enterOpened++; };
g.expand.onclick = () => {
enterOpened++;
};
configureCreditKeyboardAccess(g.root);
g.expand.dispatch('keydown', { key: 'Enter' });
g.expand.dispatch('keydown', { key: 'Enter', repeat: true });
@@ -142,7 +167,9 @@ test('held activation keys do not repeat open or close actions', () => {
test('losing focus during a Space hold cancels release activation', () => {
const f = fixture();
let opened = 0;
f.expand.onclick = () => { opened++; };
f.expand.onclick = () => {
opened++;
};
configureCreditKeyboardAccess(f.root);
f.expand.dispatch('keydown', { key: ' ' });
@@ -156,10 +183,15 @@ test('losing focus during a Space hold cancels release activation', () => {
test('Escape and backdrop dismissal close attribution and restore its disclosure', () => {
const f = fixture();
let closed = 0;
f.close.onclick = () => { closed++; };
f.close.onclick = () => {
closed++;
};
configureCreditKeyboardAccess(f.root);
f.expand.click();
const escape = f.lightbox.dispatch('keydown', { key: 'Escape', target: f.close });
const escape = f.lightbox.dispatch('keydown', {
key: 'Escape',
target: f.close,
});
assert.equal(escape.defaultPrevented, true);
assert.equal(escape.propagationStopped, true);
assert.equal(closed, 1);
@@ -185,7 +217,10 @@ test('credit keyboard setup is idempotent and safely declines incomplete markup'
assert.equal(f.close.listenerCount('blur'), 1);
assert.equal(f.lightbox.listenerCount('keydown'), 1);
assert.equal(f.overlay.listenerCount('click'), 1);
assert.equal(configureCreditKeyboardAccess({ querySelector: () => null }), false);
assert.equal(
configureCreditKeyboardAccess({ querySelector: () => null }),
false,
);
});
function textFixture() {