fix: correct waveform click-to-seek position calculation

This commit is contained in:
Armin 2026-07-08 17:10:33 +02:00
commit c8a11d9390

View file

@ -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', () => {