From c8a11d93908bc3f58e7b7a44766960389a6cad41 Mon Sep 17 00:00:00 2001 From: Armin Date: Wed, 8 Jul 2026 17:10:33 +0200 Subject: [PATCH] fix: correct waveform click-to-seek position calculation --- index.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.html b/index.html index 1bbfad7..191c226 100644 --- a/index.html +++ b/index.html @@ -1536,11 +1536,8 @@ function nextTrack() { waveformWrap.addEventListener('click', (e) => { if (!audio.duration) return; if (e.target !== waveformCanvas) return; - const t = tracks[currentIndex]; - if (!t || !t.waveform) return; const rect = waveformCanvas.getBoundingClientRect(); - const x = e.clientX - rect.left + waveformWrap.scrollLeft; - const pct = x / t.waveform.length; + const pct = (e.clientX - rect.left) / rect.width; audio.currentTime = pct * audio.duration; }); volumeSlider.addEventListener('input', () => {