[feat](trx-frontend-http): frequency-ordered z-index and hover-to-front for RDS overlay layers

Each RDS PS overlay item (position: absolute within the shared #rds-ps-overlay
container) now receives a z-index derived from its channel frequency: items are
sorted by freq_hz ascending so higher-frequency layers sit on top of
lower-frequency ones by default.

Hovering any layer temporarily assigns it the maximum z-index (entry count + 10)
to bring it to the front; mouseleave restores the frequency-derived default
stored in data-default-z.

Also reverts the incorrectly applied vchan picker layer changes from the
previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-12 20:12:23 +01:00
parent 1fe7dc88c6
commit add0a93424
4 changed files with 13 additions and 84 deletions
@@ -1364,6 +1364,12 @@ function renderRdsOverlays() {
evt.stopPropagation();
copyRdsPsToClipboard(entry.rds, entry.freq_hz);
});
el.addEventListener("mouseenter", () => {
el.style.zIndex = String(entries.length + 10);
});
el.addEventListener("mouseleave", () => {
if (el.dataset.defaultZ) el.style.zIndex = el.dataset.defaultZ;
});
rdsPsOverlay.appendChild(el);
rdsOverlayEntries.push({ ...entry, el, stackIdx: idx });
});
@@ -1386,6 +1392,10 @@ function positionRdsOverlays() {
const count = rdsOverlayEntries.length;
const mid = (count - 1) / 2;
const stackStepPx = 26;
// Assign z-indices: sort by frequency ascending so higher-frequency layers
// sit on top of lower-frequency ones in the default (non-hover) state.
const sortedByFreq = [...rdsOverlayEntries].sort((a, b) => a.freq_hz - b.freq_hz);
const freqZMap = new Map(sortedByFreq.map((e, i) => [e.id, i + 1]));
rdsOverlayEntries.forEach((entry, idx) => {
const el = entry.el;
if (!el) return;
@@ -1399,6 +1409,9 @@ function positionRdsOverlays() {
const offsetPx = Math.round((idx - mid) * stackStepPx);
el.style.left = `${clamped * width}px`;
el.style.top = `calc(50% + ${offsetPx}px)`;
const z = String(freqZMap.get(entry.id) ?? (idx + 1));
el.style.zIndex = z;
el.dataset.defaultZ = z;
});
}