mirror of
https://codeberg.org/armin/noiz.git
synced 2026-09-01 05:50:52 +02:00
fix: correct waveform click-to-seek position calculation
This commit is contained in:
parent
a970277869
commit
c8a11d9390
1 changed files with 1 additions and 4 deletions
|
|
@ -1536,11 +1536,8 @@ function nextTrack() {
|
||||||
waveformWrap.addEventListener('click', (e) => {
|
waveformWrap.addEventListener('click', (e) => {
|
||||||
if (!audio.duration) return;
|
if (!audio.duration) return;
|
||||||
if (e.target !== waveformCanvas) return;
|
if (e.target !== waveformCanvas) return;
|
||||||
const t = tracks[currentIndex];
|
|
||||||
if (!t || !t.waveform) return;
|
|
||||||
const rect = waveformCanvas.getBoundingClientRect();
|
const rect = waveformCanvas.getBoundingClientRect();
|
||||||
const x = e.clientX - rect.left + waveformWrap.scrollLeft;
|
const pct = (e.clientX - rect.left) / rect.width;
|
||||||
const pct = x / t.waveform.length;
|
|
||||||
audio.currentTime = pct * audio.duration;
|
audio.currentTime = pct * audio.duration;
|
||||||
});
|
});
|
||||||
volumeSlider.addEventListener('input', () => {
|
volumeSlider.addEventListener('input', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue