mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Add a heatmap spot size slider to the Active Fires row
A ½×–4× slider (log2 axis, 5 % steps, default 1×) under the intensity filter sets how large far-zoom heat spots are. It scales the grid, not the blur: 2× is a 1024 × 512 grid with the same one-pixel blur, so each spot grows exactly and weak lone fires don't fade as they widen. A change rebuilds only the heatmap. Share links keep it as w.s (percent, 50–400). The layer row now takes a list of sliders.
This commit is contained in:
1 parent
ef5c034dc9
commit
3139369673
26 files changed
+449
-91
No files matched your search
@@ -63,11 +63,10 @@ defineProps({
|
||||
:segmented="item.controls.segmented"
|
||||
:on-select="(optionId) => onChip(item.id, optionId)"
|
||||
/><RowSlider
|
||||
v-if="item.controls.slider"
|
||||
:slider="item.controls.slider"
|
||||
:on-input="
|
||||
(value) => onSlider(item.id, item.controls.slider.id, value)
|
||||
"
|
||||
v-for="slider in item.controls.sliders || []"
|
||||
:key="slider.id"
|
||||
:slider="slider"
|
||||
:on-input="(value) => onSlider(item.id, slider.id, value)"
|
||||
/><span
|
||||
v-for="(entry, index) in item.controls.legend"
|
||||
:key="index"
|
||||
|
||||
@@ -66,28 +66,40 @@ const fireRow = (value, active = 'all') => ({
|
||||
active: mode === active,
|
||||
})),
|
||||
},
|
||||
slider: {
|
||||
id: 'min-frp',
|
||||
label: 'Fire intensity (FRP)',
|
||||
ariaLabel: 'Minimum fire radiative power, megawatts',
|
||||
valueText: value ? `≥ ${value} MW` : 'All',
|
||||
min: 0,
|
||||
max: 1000,
|
||||
step: 1,
|
||||
value,
|
||||
track: 'linear-gradient(90deg, #9e2a1b, #fff3b0)',
|
||||
ticks: [
|
||||
{ at: 0, label: '0' },
|
||||
{ at: 0.5, label: '30' },
|
||||
],
|
||||
},
|
||||
sliders: [
|
||||
{
|
||||
id: 'min-frp',
|
||||
label: 'Fire intensity (FRP)',
|
||||
ariaLabel: 'Minimum fire radiative power, megawatts',
|
||||
valueText: value ? `≥ ${value} MW` : 'All',
|
||||
min: 0,
|
||||
max: 1000,
|
||||
step: 1,
|
||||
value,
|
||||
track: 'linear-gradient(90deg, #9e2a1b, #fff3b0)',
|
||||
ticks: [
|
||||
{ at: 0, label: '0' },
|
||||
{ at: 0.5, label: '30' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'heat-spot-size',
|
||||
label: 'Heatmap spot size',
|
||||
ariaLabel: 'Far-zoom heatmap spot size',
|
||||
valueText: '1×',
|
||||
min: 0,
|
||||
max: 1000,
|
||||
value: 333,
|
||||
ticks: [{ at: 1 / 3, label: '1×' }],
|
||||
},
|
||||
],
|
||||
legend: [],
|
||||
info: null,
|
||||
list: null,
|
||||
},
|
||||
});
|
||||
|
||||
test('a row switch and slider render their markup and report choices', () => {
|
||||
test('a row switch and sliders render their markup and report choices', () => {
|
||||
document.body.replaceChildren();
|
||||
const container = document.body.appendChild(document.createElement('div'));
|
||||
const chips = [];
|
||||
@@ -115,8 +127,13 @@ test('a row switch and slider render their markup and report choices', () => {
|
||||
segments[1].click();
|
||||
assert.deepEqual(chips, [['fires', 'confidence-high']]);
|
||||
|
||||
const block = container.querySelector('.data-toggle-slider');
|
||||
assert.equal(block.dataset.sliderId, 'min-frp');
|
||||
const blocks = [...container.querySelectorAll('.data-toggle-slider')];
|
||||
assert.deepEqual(
|
||||
blocks.map((entry) => entry.dataset.sliderId),
|
||||
['min-frp', 'heat-spot-size'],
|
||||
'sliders render in order, after the switch',
|
||||
);
|
||||
const [block, spotBlock] = blocks;
|
||||
assert.equal(
|
||||
block.querySelector('.data-toggle-slider-label').textContent,
|
||||
'Fire intensity (FRP)',
|
||||
@@ -147,7 +164,18 @@ test('a row switch and slider render their markup and report choices', () => {
|
||||
|
||||
input.value = '120';
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
assert.deepEqual(moves, [['fires', 'min-frp', 120]]);
|
||||
const spotInput = spotBlock.querySelector('input.data-toggle-slider-input');
|
||||
assert.equal(
|
||||
spotInput.getAttribute('aria-label'),
|
||||
'Far-zoom heatmap spot size',
|
||||
);
|
||||
assert.equal(spotInput.style.getPropertyValue('--slider-track'), '');
|
||||
spotInput.value = '700';
|
||||
spotInput.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
assert.deepEqual(moves, [
|
||||
['fires', 'min-frp', 120],
|
||||
['fires', 'heat-spot-size', 700],
|
||||
]);
|
||||
|
||||
// The refresh that tick triggers keeps the same nodes and updates the text.
|
||||
render(h(LayerRows, { items: [fireRow(120, 'high')], ...props }), container);
|
||||
|
||||
Reference in new issue
Block a user