-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clearRegions method has bug #3798
Comments
this.regions.forEach((region) => (region && region.remove())) |
Hmm, weird. Regions are supposed to be removed from the list on the remove event: https://github.com/katspaugh/wavesurfer.js/blob/main/src/plugins/regions.ts#L581 |
So we can only remove regions using events, not clearRegions? Because clearRegions is going to be a problem next time. |
So we can only remove regions using events, not clearRegions? Because clearRegions is going to be a problem next time |
No, the event is emitted when a region is removed. So when clear regions removes each region, it's supposed to emit a |
I see what you're said, How do I know when clearRegions has cleared all of them |
I can only use other variables to control, I can't get this moment from an event??? |
You don't need to use the event. All I'm saying is that clearRegions is supposed to remove each region from the |
When clearRegions called, you should make sure that addRegions cannot be executed, otherwise it will get messy |
I see. You can probably call addRegion with a delay (setTimeout) as a workaround. |
` ` |
I ran into the same issue and my workaround was this:
|
I used id to delete it |
Bug description
The regions array is not cleared after the clearRegions method is called
Environment
Minimal code snippet
Expected result
Obtained result
Screenshots
The text was updated successfully, but these errors were encountered: