Skip to content
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

feat add ZoomPlugin #3276

Merged
merged 3 commits into from
Oct 18, 2023
Merged

feat add ZoomPlugin #3276

merged 3 commits into from
Oct 18, 2023

Conversation

HoodyHuo
Copy link
Contributor

@HoodyHuo HoodyHuo commented Oct 17, 2023

Short description

Add zoom plugin ,which implements waveform zoom operation via mouse wheel.

Implementation details

By calculating the scaled ratio and scroll position based on the audio time at the mouse's location, the current zoom level, and the width of the div container, we can then adjust the zoom level of wavesurfer and control scrolling

How to test it

Screenshots

Peek 2023-10-17 17-03

Checklist

  • This PR is covered by e2e tests
  • It introduces no breaking API changes

Copy link
Owner

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice plugin with a clear purpose! ❤️

src/plugins/zoom.ts Outdated Show resolved Hide resolved
src/plugins/zoom.ts Outdated Show resolved Hide resolved
src/plugins/zoom.ts Outdated Show resolved Hide resolved
src/plugins/zoom.ts Outdated Show resolved Hide resolved
@HoodyHuo
Copy link
Contributor Author

I need to do anything else? This is my first PR.

@katspaugh
Copy link
Owner

Yes, I'd like the comments I left addressed.

@katspaugh
Copy link
Owner

The code looks good!
It would be nice to also add an example in the examples folder.

@HoodyHuo
Copy link
Contributor Author

The code looks good! It would be nice to also add an example in the examples folder.

nice, I will add one tomorrow.

Copy link
Owner

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@katspaugh katspaugh merged commit b305634 into katspaugh:main Oct 18, 2023
@Serek16
Copy link

Serek16 commented Nov 25, 2023

@katspaugh would be nice to have that example on the website.

@katspaugh
Copy link
Owner

Feel free to add it

@Serek16
Copy link

Serek16 commented Nov 26, 2023

I meant on wavesurfer.xyz/examples/. And if possible, I haven't found a way to do it.

@katspaugh
Copy link
Owner

katspaugh commented Nov 26, 2023

They are sourced from https://github.com/katspaugh/wavesurfer.js/tree/main/examples

Edit:
Ah, I see, the example js is already there: https://wavesurfer.xyz/examples/?zoom-plugin.js. I'll link it from the sidebar as well.

@cmorbitzer cmorbitzer mentioned this pull request Dec 8, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants