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

Improve callbacks while zooming #552

Open
ofekudi opened this issue Jul 30, 2024 · 1 comment
Open

Improve callbacks while zooming #552

ofekudi opened this issue Jul 30, 2024 · 1 comment

Comments

@ofekudi
Copy link

ofekudi commented Jul 30, 2024

Describe the bug
There are two main problems:

  1. The callback for onCropComplete is being called repeatedly while zooming - so they are being simultaneously called
  2. While zooming, the onZoomChange is being called a lot of times (maybe it's possible to throttle it)

To Reproduce
Steps to reproduce the behavior:

  1. Add logs in the onCropComplete and onZoomChange callbacks
  2. Zoom in

Expected behavior

  1. onCropComplete will be called only once - after you finish zooming (the same behavior as happens with onCropChange)
  2. onZoomChange will be called less frequently

Here's a sample of the logs while zooming in:
image

Thanks for your help! This package is super useful!

@ValentinH
Copy link
Owner

Sorry for missing this issue.
I understand your point. The problem with the zoom is that it's harder to detect that the zoom gesture is complete compared to other gestures. This is due to the wheel event not having a start/end specific event.
I guess we could add some internal logic to only fire the onCropComplete when the wheel event hasn't been received for a while. Basically debouncing it.

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

No branches or pull requests

2 participants