[fix](trx-frontend): enable BW drag handles on vchans
Use the active channel frequency for spectrum bandwidth edge hit-testing. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -927,10 +927,7 @@ function drawSignalOverlay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _bwCenterHz = (typeof vchanIsOnVirtual === "function" && vchanIsOnVirtual() &&
|
const _bwCenterHz = activeBandwidthCenterHz();
|
||||||
typeof vchanActiveChannel === "function")
|
|
||||||
? (vchanActiveChannel()?.freq_hz ?? lastFreqHz)
|
|
||||||
: lastFreqHz;
|
|
||||||
if (_bwCenterHz != null && currentBandwidthHz > 0) {
|
if (_bwCenterHz != null && currentBandwidthHz > 0) {
|
||||||
for (const spec of visibleBandwidthSpecs(_bwCenterHz)) {
|
for (const spec of visibleBandwidthSpecs(_bwCenterHz)) {
|
||||||
const span = displaySpanForBandwidthSpec(spec);
|
const span = displaySpanForBandwidthSpec(spec);
|
||||||
@@ -1298,6 +1295,11 @@ function activeChannelFreqHz() {
|
|||||||
return lastFreqHz;
|
return lastFreqHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function activeBandwidthCenterHz() {
|
||||||
|
const freqHz = activeChannelFreqHz();
|
||||||
|
return Number.isFinite(freqHz) ? freqHz : lastFreqHz;
|
||||||
|
}
|
||||||
|
|
||||||
function buildRdsOverlayHtml(rds) {
|
function buildRdsOverlayHtml(rds) {
|
||||||
const ps = rds?.program_service;
|
const ps = rds?.program_service;
|
||||||
const hasPs = !!(ps && ps.length > 0);
|
const hasPs = !!(ps && ps.length > 0);
|
||||||
@@ -7791,12 +7793,13 @@ if (overviewCanvas) {
|
|||||||
|
|
||||||
// ── BW strip edge hit-test (CSS pixels) ──────────────────────────────────────
|
// ── BW strip edge hit-test (CSS pixels) ──────────────────────────────────────
|
||||||
function getBwEdgeHit(cssX, cssW, range) {
|
function getBwEdgeHit(cssX, cssW, range) {
|
||||||
if (!lastFreqHz || !currentBandwidthHz || !lastSpectrumData) return null;
|
const bwCenterHz = activeBandwidthCenterHz();
|
||||||
|
if (!Number.isFinite(bwCenterHz) || !currentBandwidthHz || !lastSpectrumData) return null;
|
||||||
|
|
||||||
const HIT = 8;
|
const HIT = 8;
|
||||||
let bestEdge = null;
|
let bestEdge = null;
|
||||||
let bestDist = Number.POSITIVE_INFINITY;
|
let bestDist = Number.POSITIVE_INFINITY;
|
||||||
for (const spec of visibleBandwidthSpecs(lastFreqHz)) {
|
for (const spec of visibleBandwidthSpecs(bwCenterHz)) {
|
||||||
const span = displaySpanForBandwidthSpec(spec);
|
const span = displaySpanForBandwidthSpec(spec);
|
||||||
const xL = ((span.loHz - range.visLoHz) / range.visSpanHz) * cssW;
|
const xL = ((span.loHz - range.visLoHz) / range.visSpanHz) * cssW;
|
||||||
const xR = ((span.hiHz - range.visLoHz) / range.visSpanHz) * cssW;
|
const xR = ((span.hiHz - range.visLoHz) / range.visSpanHz) * cssW;
|
||||||
|
|||||||
Reference in New Issue
Block a user