[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
@@ -49,50 +49,6 @@ function vchanHandleChannels(data) {
}
}
function vchanRenderLayers() {
const container = document.getElementById("vchan-freq-layers");
if (!container) return;
container.innerHTML = "";
if (vchanChannels.length === 0) {
container.style.height = "0";
return;
}
// Sort by frequency ascending so higher-frequency channels get higher z-index.
const sorted = [...vchanChannels].sort((a, b) => a.freq_hz - b.freq_hz);
const LAYER_H_PX = 32;
const STEP_PX = 11; // vertical offset between layers so each peeks below the next
const totalH = LAYER_H_PX + (sorted.length - 1) * STEP_PX;
container.style.height = totalH + "px";
sorted.forEach((ch, i) => {
const layer = document.createElement("div");
layer.className = "vchan-freq-layer";
if (ch.id === vchanActiveId) layer.classList.add("active");
layer.style.top = (i * STEP_PX) + "px";
// Higher frequency → higher index → higher z-index (sits on top by default).
const defaultZ = i + 1;
layer.style.zIndex = defaultZ;
layer.textContent = `${ch.index}: ${vchanFmtFreq(ch.freq_hz)} ${ch.mode}`;
layer.title = `Ch ${ch.index}: ${vchanFmtFreq(ch.freq_hz)} ${ch.mode} · ${ch.subscribers} subscriber${ch.subscribers !== 1 ? "s" : ""}`;
// Bring hovered layer to the front; restore on leave.
const maxZ = sorted.length + 10;
layer.addEventListener("mouseenter", () => { layer.style.zIndex = maxZ; });
layer.addEventListener("mouseleave", () => { layer.style.zIndex = defaultZ; });
layer.addEventListener("click", () => {
if (ch.id !== vchanActiveId) vchanSubscribe(ch.id);
});
container.appendChild(layer);
});
}
function vchanRender() {
const picker = document.getElementById("vchan-picker");
if (!picker) return;
@@ -137,7 +93,6 @@ function vchanRender() {
addBtn.addEventListener("click", vchanAllocate);
picker.appendChild(addBtn);
vchanRenderLayers();
vchanSyncAccentUI();
}