From cc64c51fd0851297ed185134f8337acf774e63bc Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Wed, 18 Mar 2026 07:18:23 +0100 Subject: [PATCH] [feat](trx-frontend-http): make map source filter select exclusively on click Clicking a source chip now isolates that source instead of toggling it. Clicking the already-isolated source restores default visibility. Co-authored-by: Claude Opus 4.6 Signed-off-by: Stanislaw Grams --- .../trx-frontend/trx-frontend-http/assets/web/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index 9b5274e..59c45e1 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -4893,7 +4893,7 @@ function renderMapLocatorChipRow(container, items, selectedSet, kind) { }); if (kind === "source") { if (isDefaultSourceState) { - helperText = "Default: all non-bookmark sources visible"; + helperText = "Click a source to isolate it"; } } else if (!(selectedSet instanceof Set) || selectedSet.size === 0) { helperText = `All ${kind === "band" ? "bands" : "sources"} visible by default`; @@ -5519,7 +5519,15 @@ function initAprsMap() { const key = String(chip.dataset.filterKey || ""); if (!key) return; if (kind === "source" && Object.prototype.hasOwnProperty.call(mapFilter, key)) { - mapFilter[key] = !mapFilter[key]; + const sourceKeys = Object.keys(DEFAULT_MAP_SOURCE_FILTER); + const onlyThisSelected = mapFilter[key] && sourceKeys.every((k) => mapFilter[k] === (k === key)); + if (onlyThisSelected) { + // clicking the sole active source restores defaults + for (const k of sourceKeys) mapFilter[k] = DEFAULT_MAP_SOURCE_FILTER[k]; + } else { + // select only the clicked source + for (const k of sourceKeys) mapFilter[k] = (k === key); + } if (!mapFilter.aprs && selectedAprsTrackCall) { const entry = stationMarkers.get(String(selectedAprsTrackCall)); if (entry && entry.track && aprsMap && aprsMap.hasLayer(entry.track)) {