-
-
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
regions plugin: add regionsMinLength option #2009
Conversation
@sundayz can you also take a look? ps. I'm not a fan of the parameter name @marizuccara |
src/plugin/regions/region.js
Outdated
@@ -614,10 +616,19 @@ export class Region { | |||
* @param {string} direction 'start 'or 'end' | |||
*/ | |||
onResize(delta, direction) { | |||
let minLength = null; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment so people know a region's minLength is used over generalMinLength if both are specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @marizuccara
Maybe When I tried testing this, generalMinLength seems to always be edit: okay so I see generalMinLength only applies to regions created by dragging the mouse. (example code, might not work) // first wait for the region plugin to be loaded
wavesurfer.on('plugin-added', name => {
if (name == 'regions') {
// now any regions created after the plugin was loaded (i.e. via mouse drag) have minlength of 1.5
wavesurfer.on('region-created', region => region.minLength = 1.5)
}
}) |
I'm agree, thanks. Later fix |
So sorry for the absence :( |
@marizuccara there are many old, unrelated changes in this PR, can you take a look at that? |
@sundayz have you take a look at this PR if you'll have time? |
I tested the change and it works as intended:
Works well, just need to update HTML for the examples page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see inline comment and there's a merge conflict with this branch.
* rebased fork * added comment to minLength param
Added
generalMinLength
parameter to control min length of regions created dragging on drawer (so not those passed on initialization inregions
array), to avoid dragging regions to size 0.NB. Maybe unify in some way
minLength
andgeneralMinLength
parameters if necesssary?Related Issues and other PRs:
PR #2002
ISSUES #2001 #2008