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

How to disable the click event when drag & drop #452

Open
EkaLinMan opened this issue Feb 7, 2024 · 3 comments
Open

How to disable the click event when drag & drop #452

EkaLinMan opened this issue Feb 7, 2024 · 3 comments

Comments

@EkaLinMan
Copy link

EkaLinMan commented Feb 7, 2024

There is a demo that we can trigger the click event when we click the button, is there any way to prevent triggering the click event when drag & drop (Pan) on the button? Because my view is clickable everywhere, I hope to disable it when executing the drag & drop. Thanks!

https://bettertyped.github.io/react-zoom-pan-pinch/?path=/story/examples-controls--controls
image

@acai69
Copy link

acai69 commented Feb 7, 2024

Add delay to click

@lucasmoeskops
Copy link

lucasmoeskops commented Apr 4, 2024

I have the same problem but I don't understand the solution "Add delay to click". Can you provide an example @acai69 ? Thanks!

I solved it for now by measuring the length between the mouseDown and mouseUp and preventing the click if this is longer than 250ms (kind of arbitrary). But ideally this click event is not triggered at all imho.

@acai69
Copy link

acai69 commented Apr 5, 2024

and preventing the click if this is longer than 250ms

That's 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

3 participants