click on waveform

This commit is contained in:
2025-10-13 11:17:20 +02:00
parent 4df063f9b3
commit 179c52facc
4 changed files with 23 additions and 7 deletions

View File

@ -8,7 +8,7 @@
selectionStart?: number | null;
selectionEnd?: number | null;
onselectionchange?: (start: number | null, end: number | null) => void;
onclick?: () => void;
onclick?: (timeOffset: number) => void;
}
let {
@ -75,8 +75,9 @@
}
}
if (onclick) {
onclick();
if (onclick && buffer) {
const timeOffset = (x / canvas.width) * (buffer.length / buffer.sampleRate);
onclick(timeOffset);
}
}