diff --git a/index.html b/index.html index 48f95d1..d68e926 100644 --- a/index.html +++ b/index.html @@ -207,8 +207,8 @@ footer .footer-track { flex: 1; min-width: 0; white-space: nowrap; overflow: hid Peak Decay: @@ -541,9 +541,10 @@ function drawSpectrum() { const gap = 4; const labelW = 12; const segCount = 32; - const segArea = vw - labelW - segCount; - const segW = segArea / segCount; const segG = 1; + const segW = Math.floor((vw - labelW - (segCount - 1) * segG) / segCount); + const totalSegW = segCount * segW + (segCount - 1) * segG; + const segLeft = labelW + Math.floor(((vw - labelW) - totalSegW) / 2); function getLevel(analyserCh) { const td = new Uint8Array(analyserCh.fftSize); analyserCh.getByteTimeDomainData(td); @@ -567,7 +568,7 @@ function drawSpectrum() { if (level > peak) peak = level; else peak *= 0.990; for (let i = 0; i < segCount; i++) { - const sx = labelW + i * (segW + segG); + const sx = segLeft + i * (segW + segG); const on = i < lit; const pi = Math.round(peak * segCount); vuctx.fillStyle = on ? '#84a0c6' : '#1e2132';