[fix](trx-frontend-http): remove duplicate bandplan overlay from spectrum canvas
The bandplan strip was rendered twice: once as a DOM element above the spectrum and again via WebGL directly on the spectrum canvas. Remove the WebGL duplicate and keep only the DOM-based strip. https://claude.ai/code/session_01TA1pCDuAr7V6oSnQs7JYvU Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1214,17 +1214,6 @@ const BW_OVERLAY_COLORS = {
|
|||||||
hard: [240 / 255, 173 / 255, 78 / 255, 0.38],
|
hard: [240 / 255, 173 / 255, 78 / 255, 0.38],
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bandplan mode colours for WebGL rendering (normalised RGBA).
|
|
||||||
const BANDPLAN_MODE_COLORS = {
|
|
||||||
CW: [74 / 255, 144 / 255, 217 / 255, 0.55],
|
|
||||||
Phone: [76 / 255, 175 / 255, 80 / 255, 0.50],
|
|
||||||
Narrow: [217 / 255, 74 / 255, 122 / 255, 0.50],
|
|
||||||
FM: [1, 152 / 255, 0, 0.50],
|
|
||||||
All: [120 / 255, 120 / 255, 120 / 255, 0.40],
|
|
||||||
Beacon: [156 / 255, 39 / 255, 176 / 255, 0.50],
|
|
||||||
Satellite: [0, 188 / 255, 212 / 255, 0.50],
|
|
||||||
};
|
|
||||||
const BANDPLAN_STRIP_CSS_HEIGHT = 18; // CSS pixels
|
|
||||||
const BOOKMARK_MARKER_FALLBACK = "#66d9ef";
|
const BOOKMARK_MARKER_FALLBACK = "#66d9ef";
|
||||||
|
|
||||||
function overviewWfResetTextureCache() {
|
function overviewWfResetTextureCache() {
|
||||||
@@ -10193,38 +10182,6 @@ function drawSpectrum(data) {
|
|||||||
spectrumGl.drawPoints(spectrumTmpMarkerPoints, Math.max(2, dpr * 1.6), cssColorToRgba(pal.waveformPeak));
|
spectrumGl.drawPoints(spectrumTmpMarkerPoints, Math.max(2, dpr * 1.6), cssColorToRgba(pal.waveformPeak));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Bandplan WebGL strip (top of spectrum) ──
|
|
||||||
if (bandplanRegion !== "off" && bandplanData) {
|
|
||||||
const bpSegs = bandplanVisibleSegments(bandplanRegion, range.visLoHz, range.visHiHz);
|
|
||||||
if (bpSegs.length > 0) {
|
|
||||||
const bpH = Math.round(BANDPLAN_STRIP_CSS_HEIGHT * dpr);
|
|
||||||
const bpY = 0;
|
|
||||||
// Dark backdrop so segments are readable over the spectrum fill.
|
|
||||||
spectrumGl.fillRect(0, bpY, W, bpH, [0.07, 0.09, 0.15, 0.82]);
|
|
||||||
// Thin separator line at bottom of bandplan strip.
|
|
||||||
spectrumGl.drawSegments([0, bpH, W, bpH],
|
|
||||||
[1, 1, 1, 0.08], Math.max(1, dpr * 0.5));
|
|
||||||
const bpVerts = [];
|
|
||||||
for (const seg of bpSegs) {
|
|
||||||
const l = Math.max(0, (seg.low_hz - range.visLoHz) / range.visSpanHz);
|
|
||||||
const r = Math.min(1, (seg.high_hz - range.visLoHz) / range.visSpanHz);
|
|
||||||
const xL = l * W;
|
|
||||||
const xW = Math.max(1, (r - l) * W);
|
|
||||||
const col = BANDPLAN_MODE_COLORS[seg.mode] || BANDPLAN_MODE_COLORS.All;
|
|
||||||
// Build two triangles per segment (batched into one draw call).
|
|
||||||
bpVerts.push(
|
|
||||||
xL, bpY, col[0], col[1], col[2], col[3],
|
|
||||||
xL + xW, bpY, col[0], col[1], col[2], col[3],
|
|
||||||
xL + xW, bpY + bpH, col[0], col[1], col[2], col[3],
|
|
||||||
xL, bpY, col[0], col[1], col[2], col[3],
|
|
||||||
xL + xW, bpY + bpH, col[0], col[1], col[2], col[3],
|
|
||||||
xL, bpY + bpH, col[0], col[1], col[2], col[3],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
spectrumGl.drawTriangles(bpVerts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Crosshair lines ──
|
// ── Crosshair lines ──
|
||||||
if (spectrumCrosshairX != null && spectrumCrosshairY != null) {
|
if (spectrumCrosshairX != null && spectrumCrosshairY != null) {
|
||||||
const cx = spectrumCrosshairX * dpr;
|
const cx = spectrumCrosshairX * dpr;
|
||||||
@@ -11675,7 +11632,7 @@ function bandplanVisibleSegments(region, loHz, hiHz) {
|
|||||||
|
|
||||||
function _hideBandplanStrip() {
|
function _hideBandplanStrip() {
|
||||||
if (!bandplanStripEl) return;
|
if (!bandplanStripEl) return;
|
||||||
bandplanStripEl.classList.remove("bp-visible", "bp-webgl");
|
bandplanStripEl.classList.remove("bp-visible");
|
||||||
bandplanStripEl.innerHTML = "";
|
bandplanStripEl.innerHTML = "";
|
||||||
bandplanCacheKey = "";
|
bandplanCacheKey = "";
|
||||||
}
|
}
|
||||||
@@ -11693,22 +11650,9 @@ function updateBandplanStrip(range) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When spectrum canvas is visible the coloured segments are rendered via
|
|
||||||
// WebGL inside drawSpectrum(). The DOM strip then only provides text labels
|
|
||||||
// overlaid at the bottom of the spectrum canvas. For non-SDR rigs (no
|
|
||||||
// spectrum) the strip falls back to the original DOM-coloured rendering.
|
|
||||||
const spectrumPanelEl = document.getElementById("spectrum-panel");
|
|
||||||
const webglMode = spectrumPanelEl && getComputedStyle(spectrumPanelEl).display !== "none";
|
|
||||||
|
|
||||||
bandplanStripEl.classList.add("bp-visible");
|
bandplanStripEl.classList.add("bp-visible");
|
||||||
if (webglMode) {
|
|
||||||
bandplanStripEl.classList.add("bp-webgl");
|
|
||||||
} else {
|
|
||||||
bandplanStripEl.classList.remove("bp-webgl");
|
|
||||||
}
|
|
||||||
|
|
||||||
const newKey = bandplanRegion + ":" + (bandplanShowLabels ? "L" : "N") + ":" +
|
const newKey = bandplanRegion + ":" + (bandplanShowLabels ? "L" : "N") + ":" +
|
||||||
(webglMode ? "G:" : "D:") +
|
|
||||||
segments.map((s) => s.low_hz + "-" + s.high_hz).join(",");
|
segments.map((s) => s.low_hz + "-" + s.high_hz).join(",");
|
||||||
|
|
||||||
const stripW = bandplanStripEl.clientWidth || 1;
|
const stripW = bandplanStripEl.clientWidth || 1;
|
||||||
|
|||||||
@@ -3301,14 +3301,6 @@ button:focus-visible, input:focus-visible, select:focus-visible {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── WebGL overlay mode ── When the spectrum canvas is visible the coloured
|
|
||||||
segments are also rendered via WebGL inside drawSpectrum(). The DOM strip
|
|
||||||
stays above the waterfall with its own coloured segments visible. */
|
|
||||||
#spectrum-bandplan-strip.bp-webgl {
|
|
||||||
/* No repositioning needed – the strip lives above the overview strip
|
|
||||||
in the .signal-visual-block flex flow. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Legend in settings */
|
/* Legend in settings */
|
||||||
.bandplan-legend-grid {
|
.bandplan-legend-grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user