mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Main brings the reviewed one-time-control and timeline-mark changes. They keep this branch's renderer work: earthquakes draw through the draw port and register their strong quakes as marks; the weather clock keeps `follows` beside `world`; the weather layer measures ages and delays from the timeline time; the Visual panel keeps its sky and weather groups under Effects. Tests that moved time through the weather clock now move it on the world clock.
This commit is contained in:
commit
0ecbfbecd0
123 files changed
+5917
-1471
No files matched your search
@@ -108,7 +108,11 @@ test('bloom and sharpen render their state, slider and readout', async (t) => {
|
||||
await nextTick();
|
||||
assert.equal($('bloom-toggle').classList.contains('active'), false);
|
||||
assert.equal($('bloom-slider-row').classList.contains('visible'), false);
|
||||
assert.equal($('bloom-intensity-value').textContent, '140%', 'the amount stays');
|
||||
assert.equal(
|
||||
$('bloom-intensity-value').textContent,
|
||||
'140%',
|
||||
'the amount stays',
|
||||
);
|
||||
});
|
||||
|
||||
test('a publish never rewrites a slider the user is dragging', async (t) => {
|
||||
@@ -314,6 +318,73 @@ test('Scope and Celestial render what VisualSettings shows', async (t) => {
|
||||
assert.equal(celestial.title, 'Celestial ring — reveal the full globe');
|
||||
});
|
||||
|
||||
test('scope opacity renders what VisualSettings shows and sets the mask', async (t) => {
|
||||
const { store, $ } = fixture(t);
|
||||
const { owner } = settings(store);
|
||||
const mask = { opacity: 1 };
|
||||
owner.services = {
|
||||
...owner.services,
|
||||
setScopeMaskEnabled() {},
|
||||
setScopeMaskOpacity: (value) => (mask.opacity = value),
|
||||
};
|
||||
assert.equal($('scope-opacity-slider').value, '100');
|
||||
assert.equal($('scope-opacity-value').textContent, '100%');
|
||||
|
||||
owner._setScope({ opacityPct: 62.4 });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 0.62);
|
||||
assert.equal($('scope-opacity-slider').value, '62');
|
||||
assert.equal($('scope-opacity-value').textContent, '62%');
|
||||
assert.equal(store.view.scope.opacityPct, 62);
|
||||
|
||||
// No fainter than the floor, where the view would read as Scope off.
|
||||
owner._setScope({ opacityPct: 10 });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 0.5, 'floored');
|
||||
assert.equal($('scope-opacity-value').textContent, '50%');
|
||||
assert.equal($('scope-opacity-slider').min, '50');
|
||||
|
||||
// A value that is not a number changes nothing.
|
||||
owner._setScope({ opacityPct: Number.NaN });
|
||||
await nextTick();
|
||||
assert.equal($('scope-opacity-value').textContent, '50%');
|
||||
|
||||
owner._setScope({ opacityPct: 180 });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 1, 'clamped');
|
||||
assert.equal($('scope-opacity-value').textContent, '100%');
|
||||
|
||||
owner._setScope({ opacityPct: 70 }, { apply: false });
|
||||
await nextTick();
|
||||
assert.equal(mask.opacity, 1, 'only shown');
|
||||
assert.equal($('scope-opacity-value').textContent, '70%');
|
||||
|
||||
owner._setScope({ enabled: false });
|
||||
await nextTick();
|
||||
assert.equal($('scope-opacity-slider').disabled, true, 'off with the scope');
|
||||
assert.equal(store.view.scope.opacityPct, 70, 'kept while off');
|
||||
});
|
||||
|
||||
test('the Visual panel groups its controls and words its on/off pills', (t) => {
|
||||
const { $ } = fixture(t);
|
||||
const panel = $('pp-toggles');
|
||||
assert.deepEqual(
|
||||
[
|
||||
...panel.querySelectorAll(
|
||||
'.pp-section-heading, .visual-presets__heading',
|
||||
),
|
||||
].map((el) => el.textContent.trim()),
|
||||
['Look', 'MAP SOURCE 3D', 'Overlay', 'Effects'],
|
||||
);
|
||||
assert.equal(panel.querySelector('.pp-header-label').textContent, 'VISUAL');
|
||||
const body = panel.querySelector('.pp-panel-body');
|
||||
assert.equal(body.style.getPropertyValue('--pp-pill-on'), '"ON"');
|
||||
assert.equal(body.style.getPropertyValue('--pp-pill-off'), '"OFF"');
|
||||
const reset = panel.querySelector('.pp-reset-btn');
|
||||
assert.equal(reset, body.lastElementChild, 'the reset closes the panel');
|
||||
assert.equal(reset.textContent.trim(), 'restart_altReset to default');
|
||||
});
|
||||
|
||||
test('the 3D aircraft group renders what AircraftDisplay shows', async (t) => {
|
||||
const { store, $ } = fixture(t);
|
||||
const params = [];
|
||||
@@ -331,7 +402,10 @@ test('the 3D aircraft group renders what AircraftDisplay shows', async (t) => {
|
||||
assert.equal(coreClasses(button), 'pp-toggle-btn active');
|
||||
assert.equal(button.getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(row.classList.contains('visible'), true);
|
||||
assert.equal($('models3d-mode-proximity').getAttribute('aria-checked'), 'true');
|
||||
assert.equal(
|
||||
$('models3d-mode-proximity').getAttribute('aria-checked'),
|
||||
'true',
|
||||
);
|
||||
|
||||
// The button leaves the row to its own sync.
|
||||
owner._setModels3dEnabled(false);
|
||||
@@ -347,7 +421,10 @@ test('the 3D aircraft group renders what AircraftDisplay shows', async (t) => {
|
||||
await nextTick();
|
||||
assert.equal(all.classList.contains('active'), true);
|
||||
assert.equal(all.getAttribute('aria-checked'), 'true');
|
||||
assert.equal($('models3d-mode-proximity').classList.contains('active'), false);
|
||||
assert.equal(
|
||||
$('models3d-mode-proximity').classList.contains('active'),
|
||||
false,
|
||||
);
|
||||
assert.deepEqual(params.at(-1), ['military', { models3dMode: 'all' }]);
|
||||
|
||||
owner._syncModels3dFromLayerState({
|
||||
@@ -376,12 +453,18 @@ test('the Draw controls render what the draw tool publishes', async (t) => {
|
||||
assert.equal(segment('area').getAttribute('aria-label'), 'Area');
|
||||
assert.equal(segment('area').title, 'Area');
|
||||
assert.equal(segment('area').textContent, 'pentagon');
|
||||
const swatch = (color) => document.querySelector(`#draw-colors [data-color="${color}"]`);
|
||||
const swatch = (color) =>
|
||||
document.querySelector(`#draw-colors [data-color="${color}"]`);
|
||||
assert.equal(swatch('primary').getAttribute('aria-checked'), 'true');
|
||||
assert.equal(swatch('amber').getAttribute('aria-label'), 'Amber');
|
||||
assert.equal($('draw-hint').textContent, '');
|
||||
|
||||
store.publishDraw({ active: true, shape: 'line', color: 'amber', hint: 'Click to add points.' });
|
||||
store.publishDraw({
|
||||
active: true,
|
||||
shape: 'line',
|
||||
color: 'amber',
|
||||
hint: 'Click to add points.',
|
||||
});
|
||||
await nextTick();
|
||||
assert.equal(swatch('amber').getAttribute('aria-checked'), 'true');
|
||||
assert.equal(swatch('primary').classList.contains('active'), false);
|
||||
@@ -476,7 +559,10 @@ test('the imported files render what the file import publishes and keep focus',
|
||||
assert.equal(document.activeElement === button(first, 'toggle'), true);
|
||||
assert.equal(button(first, 'toggle').getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(button(first, 'fly').title, 'Fly to <b>a</b>.geojson');
|
||||
assert.equal(button(first, 'remove').getAttribute('aria-label'), 'Remove <b>a</b>.geojson');
|
||||
assert.equal(
|
||||
button(first, 'remove').getAttribute('aria-label'),
|
||||
'Remove <b>a</b>.geojson',
|
||||
);
|
||||
|
||||
await press(button(first, 'remove'));
|
||||
assert.equal(rowsNow().length, 1);
|
||||
@@ -592,7 +678,11 @@ test('VisualSettings publishes a style’s parameters and writes a moved slider
|
||||
assert.equal(store.parameters, null, 'the sliders go with their owner');
|
||||
assert.equal($('param-slider-panel').classList.contains('active'), false);
|
||||
assert.equal(store.act('setStyleParameter', 'grainAmt', 0.2), undefined);
|
||||
assert.equal(owner.stages.noir.uniforms.grainAmt, 0.3, 'a stopped owner no longer answers');
|
||||
assert.equal(
|
||||
owner.stages.noir.uniforms.grainAmt,
|
||||
0.3,
|
||||
'a stopped owner no longer answers',
|
||||
);
|
||||
// An older owner's stop leaves a newer owner's rows.
|
||||
const newer = { style: 'noir', rows: [] };
|
||||
owner._parameters = { style: 'noir', rows: [] };
|
||||
@@ -604,10 +694,16 @@ test('VisualSettings publishes a style’s parameters and writes a moved slider
|
||||
test('the four Cockpit groups teleport to the published slots and back to their places', async (t) => {
|
||||
const { store, $ } = fixture(t);
|
||||
const groupOf = (id) => $(id).closest('.pp-toggle-group') ?? $(id);
|
||||
const ids = ['hud-toggle', 'detection-toggle', 'param-slider-panel', 'models3d-toggle'];
|
||||
const ids = [
|
||||
'hud-toggle',
|
||||
'detection-toggle',
|
||||
'param-slider-panel',
|
||||
'models3d-toggle',
|
||||
];
|
||||
const body = $('pp-toggles').querySelector('.pp-panel-body');
|
||||
const order = () =>
|
||||
[...body.children].filter((el) => el.matches('.pp-toggle-group, #param-slider-panel'))
|
||||
[...body.children]
|
||||
.filter((el) => el.matches('.pp-toggle-group, #param-slider-panel'))
|
||||
.map((el) => el.id || el.querySelector('[id]')?.id);
|
||||
const home = order();
|
||||
const popover = document.body.appendChild(document.createElement('div'));
|
||||
|
||||
Reference in new issue
Block a user