From 94ee52aace90b3e4001e500e8ef7ea81f5c32872 Mon Sep 17 00:00:00 2001 From: Armin Date: Wed, 8 Jul 2026 20:24:30 +0200 Subject: [PATCH] clamp VU meter peak indicator to last valid LED index to prevent cut-off 33rd position --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index adc6550..b2606f3 100644 --- a/index.html +++ b/index.html @@ -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);