From cffa0329c559d1d720b5ec3f66026c171a177fdb Mon Sep 17 00:00:00 2001 From: Lewis Moten Date: Tue, 7 May 2024 01:11:44 -0400 Subject: [PATCH] Display "real" channel ID's that skip hidden channels --- index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index f351165..41a4ec6 100644 --- a/index.js +++ b/index.js @@ -1347,13 +1347,20 @@ function drawChannelNumbers(ctx, channelCount, width, height) { ctx.fillRect(offset, 0, (fontHeight * maxDigits), channelHeight * channelCount); for(let channelIndex = 0; channelIndex < channelCount; channelIndex++) { let top = channelHeight * channelIndex; - let text = channelIndex.toString(); + let text = realChannel(channelIndex).toString(); const textTop = top + (channelHeight / 2); const hue = channelHue(channelIndex, channelCount); ctx.fillStyle = `hsl(${hue}, 100%, 50%)`; ctx.fillText(text, offset + 5, textTop); } } +function realChannel(id) { + EXCLUDED_CHANNELS.sort(compareNumbers); + for(let i = 0; i < EXCLUDED_CHANNELS.length; i++) { + if(EXCLUDED_CHANNELS[i] <= id) id++; + } + return id; +} function drawFrequencyData(forcedDraw) { if(PAUSE && forcedDraw !== true) return; if(frequencyOverTime.length === 0) { @@ -1547,7 +1554,7 @@ function handleReceivedChannelGraphClick(e) { if(CHANNEL_SELECTED === -1) { document.getElementById('selected-channel').innerText = 'N/A'; } else { - document.getElementById('selected-channel').innerText = CHANNEL_SELECTED; + document.getElementById('selected-channel').innerText = realChannel(CHANNEL_SELECTED); }