-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Feature Request: Allow programmatic zooming / default zoom value #3908
Comments
Doesn’t the zoom method already cover it? |
Ah I wasn't aware of this -- it's a big help for the first suggestion. Also it'd be nice to have an option for the zoom method to animate so the user can tell what is changing instead of just a sudden waveform change. Thank you for your help though! |
I also needed a default or rather minimum zoom value for each waveform. I handled this by calculating the minimum pixels per second from the duration of the audio and the size of the container. What you see on the screen are the results, which work perfectly for me. I set the minimum just 10 pixels below that initial value, to prevent the scrollbar from automatically being activated and to give the user room to adjust the scrollbar to a minimum, below the initial value. This isn't all of the code but it should be enough to follow what I did. Note, I show what the current value is in the image but once I'm finished with my coding, I am going to hide the label showing the current zoom value, as its for testing purposes only. This enables a per-waveform default zoom and also enables a consistent responsive zoom experience. Notice that the length of the audio guides the process. My audio files can be less than one second and as long as 30 seconds in length. The responsiveness of the zoom is consistent across all of the waveforms. The instance being passed is ' wavesurfer{idx} ' and the others are the selectors for the UI elements. For the resize event, I had to push all of the instances and loop through them. It took me a little while to make this work consistently across waveforms and hopefully this works for you too.
|
Currently there is no way to programmatically control ZoomPlugin. There are a number of use cases where this would be helpful.
• For long audio files, it would make sense to allow a default zoom value (i.e. show 30s of audio on screen) because a super long horizontally squished waveform is not particularly useful. Similar to the how the minimap plugin is working but allowing us to set a custom zoom level.
• Mousewheel scrolling isn't always obvious for users, so having the option to create a separate slider would be really nice if we could control the zoom through code.
• For those of us using regions plugin, it'd be awesome to be able to zoom into a specific region when the user creates or interacts with it.
• Having the option to programatically zoom into a specific part of the track to bring the user's attention to it has a ton of benefits for a bunch of different uses cases.
My suggestion is
• Add an option to zoomPlugin something like
intialZoom
• Add a function to zoomplugin
zoomTo
that takes two timestamps start, end, and sets the zoom appropriately..Thanks so much for all your hard work on this project!
The text was updated successfully, but these errors were encountered: