click on waveform
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user