clamp VU meter peak indicator to last valid LED index to prevent cut-off 33rd position

This commit is contained in:
Armin 2026-07-08 20:24:30 +02:00
commit 94ee52aace

View file

@ -616,8 +616,8 @@ function drawSpectrum() {
else { vuPeakR *= 0.990; }
drawVuRow(0, levelL);
drawVuRow(gap + rowH, levelR);
const piL = Math.round(vuPeakL * segCount);
const piR = Math.round(vuPeakR * segCount);
const piL = Math.min(segCount - 1, Math.round(vuPeakL * segCount));
const piR = Math.min(segCount - 1, Math.round(vuPeakR * segCount));
if (vuPeakL > 0.05) {
vuctx.fillStyle = '#e98989';
vuctx.fillRect(segLeft + piL * (segW + segG), 0, segW, rowH);