bbc / peaks.js

JavaScript UI component for interacting with audio waveforms
https://waveform.prototyping.bbc.co.uk
GNU Lesser General Public License v3.0
3.22k stars 281 forks source link

" peaks.segments.add(): startTime should not be negative " by insert-segment mode #545

Open jason30704 opened 2 months ago

jason30704 commented 2 months ago

Hello, I found that when using insert-segment mode, if you click close to the border, there is a chance that the following error may be triggered.

https://github.com/user-attachments/assets/09cf0dea-7102-4399-a0a0-5b1e8200b716

image

chrisn commented 2 months ago

This happens because MouseEvent offsetX property can sometimes be -1. I'm not sure why this happens.

jason30704 commented 2 months ago

Is there any way to prevent this error now?

chrisn commented 2 months ago

Not yet, I have very little time to investigate. But thank you, everything you're reporting will help make improvements.