mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(fires): FRP intensity filter, confidence switch and six-stop color ramp (HAL-676)
Color every FIRMS detection by fire radiative power on the Portolan cold → hot ramp (blue · teal · lime · amber · orange · red at 0 · 5 · 20 · 50 · 100 · 300 MW), replacing the three warm stops that made a 2 MW and a 40 MW fire look alike. Heat cells, glow sprites and card accents all read the same ramp (src/data/firmsIntensity.js). Add a minimum-FRP log slider whose track is painted with the ramp (so it doubles as the legend), an All / Nominal+ / High confidence switch and an "N of M shown" counter to the Active Fires row. The filter runs once in ingestion.applyFilter(), so markers, cards, heat cells, the context store, the top-fires query and the analyst records all see one set. Default is 0 MW / All: many of the strongest fires are rated low. Persist both options in the layer state (token w: minFrp `f`, confidence `c`), including the short share codec, and give the agent's get_active_fires tool matching min_frp_mw / confidence arguments. Layer panel gains generic `slider` and `segmented` row descriptors (src/ui/rowFilterControls.js). New strings in es / ru / zh-CN. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
15de9d738c
commit
38d29f2beb
27 files changed
+1500
-70
No files matched your search
+48
-6
@@ -1,4 +1,5 @@
|
||||
import { syncChipGroup } from './chipGroup.js';
|
||||
import { syncSegmentedGroup, syncSliderBlock } from './rowFilterControls.js';
|
||||
import { syncRowList } from './rowList.js';
|
||||
import { layerFeedState } from '../data/feedState.js';
|
||||
export { layerFeedState } from '../data/feedState.js';
|
||||
@@ -388,18 +389,42 @@ export class LayerPanel {
|
||||
const controls = document.createElement('div');
|
||||
controls.className = 'data-toggle-controls';
|
||||
this._bind(controls, 'click', (event) => {
|
||||
const button = event.target?.closest?.('.data-toggle-chip');
|
||||
const button =
|
||||
event.target?.closest?.('.data-toggle-chip') ||
|
||||
event.target?.closest?.('.data-toggle-segment');
|
||||
if (!button || button.disabled) return;
|
||||
// Re-read the live descriptor rather than trusting the rendered
|
||||
// chip, so a stale row can never apply an inverted toggle.
|
||||
const chip = this._rowControlsFor(layer.id)?.chips?.find(
|
||||
(entry) => entry.id === button.dataset.chipId,
|
||||
);
|
||||
const live = this._rowControlsFor(layer.id);
|
||||
const chip =
|
||||
live?.chips?.find(
|
||||
(entry) => entry.id === button.dataset.chipId,
|
||||
) ||
|
||||
live?.segmented?.options?.find(
|
||||
(entry) => entry.id === button.dataset.chipId,
|
||||
);
|
||||
if (!chip || chip.disabled || !this.isEnabled(layer.id)) return;
|
||||
if (typeof chip.onClick === 'function') chip.onClick();
|
||||
else if (chip.params)
|
||||
this.setLayerParams(layer.id, chip.params, { origin: 'user' });
|
||||
});
|
||||
// A row slider (e.g. the Active Fires minimum-FRP filter) maps its
|
||||
// position to params through the live descriptor on every tick.
|
||||
this._bind(controls, 'input', (event) => {
|
||||
const input = event.target;
|
||||
if (!input?.matches?.('.data-toggle-slider-input')) return;
|
||||
const slider = this._rowControlsFor(layer.id)?.slider;
|
||||
if (
|
||||
!slider ||
|
||||
slider.id !== input.dataset.sliderId ||
|
||||
typeof slider.params !== 'function' ||
|
||||
!this.isEnabled(layer.id)
|
||||
)
|
||||
return;
|
||||
this.setLayerParams(layer.id, slider.params(input.value), {
|
||||
origin: 'user',
|
||||
});
|
||||
});
|
||||
row.appendChild(controls);
|
||||
// An ordered list below the chips, for a layer whose row carries a
|
||||
// sequence (turn-by-turn directions). Its own delegated listener, its
|
||||
@@ -521,13 +546,30 @@ export class LayerPanel {
|
||||
const chips = controls?.chips || [];
|
||||
const legend = controls?.legend || [];
|
||||
const infoText = controls?.info;
|
||||
const slider = controls?.slider || null;
|
||||
const segmented = controls?.segmented || null;
|
||||
this._syncRowList(listContainer, controls?.list || null);
|
||||
container.hidden = chips.length === 0 && legend.length === 0 && !infoText;
|
||||
container.hidden =
|
||||
chips.length === 0 &&
|
||||
legend.length === 0 &&
|
||||
!infoText &&
|
||||
!slider &&
|
||||
!segmented;
|
||||
|
||||
const info = container._rowControlsInfo || null;
|
||||
const firstLegend = container.querySelector('.data-toggle-legend-item');
|
||||
|
||||
syncChipGroup(container, chips, { before: firstLegend || info });
|
||||
// Order: chips, switch, slider, legend, info.
|
||||
syncSegmentedGroup(container, segmented, { before: firstLegend || info });
|
||||
const switchNode = container.querySelector('.data-toggle-segmented');
|
||||
syncSliderBlock(container, slider, {
|
||||
before: switchNode?.nextSibling || firstLegend || info,
|
||||
});
|
||||
const firstControl =
|
||||
switchNode || container.querySelector('.data-toggle-slider');
|
||||
syncChipGroup(container, chips, {
|
||||
before: firstControl || firstLegend || info,
|
||||
});
|
||||
|
||||
const legendSignature = JSON.stringify(
|
||||
legend.map(({ label, color, count, blurb }) => [
|
||||
|
||||
Reference in new issue
Block a user