From 3d284abab62b08f0a502bea240053b07e507961b Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Wed, 11 Mar 2026 07:30:24 +0100 Subject: [PATCH] [fix](trx-frontend-http): center BW overlay on active virtual channel freq When subscribed to a non-primary virtual channel the bandwidth overlay was still anchored to lastFreqHz (channel 0). Resolve the effective center from the active vchan when vchanIsOnVirtual() is true. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Stan Grams --- .../trx-frontend/trx-frontend-http/assets/web/app.js | 8 ++++++-- 1 file changed, 6 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 e9c225c..6d19dc4 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 @@ -924,8 +924,12 @@ function drawSignalOverlay() { } } - if (lastFreqHz != null && currentBandwidthHz > 0) { - for (const spec of visibleBandwidthSpecs(lastFreqHz)) { + const _bwCenterHz = (typeof vchanIsOnVirtual === "function" && vchanIsOnVirtual() && + typeof vchanActiveChannel === "function") + ? (vchanActiveChannel()?.freq_hz ?? lastFreqHz) + : lastFreqHz; + if (_bwCenterHz != null && currentBandwidthHz > 0) { + for (const spec of visibleBandwidthSpecs(_bwCenterHz)) { const span = displaySpanForBandwidthSpec(spec); const xL = hzToX(span.loHz); const xR = hzToX(span.hiHz);