yifaneye / react-gallery-carousel

Carousel component 🎠🎠🎠 supporting touch, mouse, keyboard, thumbnails, fullscreen, lazy loading, SSR and customisations. 👉 Live editor: https://yifanai.com/rgcd1
https://yifanai.com/rgc
MIT License
215 stars 30 forks source link

Maximize and minimize using soft touch on trackpad #80

Open jr-dw-dev opened 1 year ago

jr-dw-dev commented 1 year ago

Describe the bug If I use the soft touch of my Macbook trackpad and do not push it down physically in order to click the image to zoom in or out (maximizeOnClick and minimizeOnClick), it sometimes works and sometimes doesn't. This happens because the event.buttons property of the mouseDown-Event is randomly set to 0 or 1. As you check for it to be > 0, it randomly just does nothing.

It would be cool if you could remove the check for event.buttons > 0 from the handleMouseDown method for it to work on Macbooks again.

To Reproduce Steps to reproduce the behavior:

  1. activate shouldMaximizeOnClick and/or shouldMinimizeOnClick
  2. Tap on the image using soft touch of trackpad multiple times
  3. randomly it will do what you expect it to do or just do nothing without an error

Expected behavior maximize and minimize work with trackpad

Desktop (please complete the following information):

jr-dw-dev commented 1 year ago

Reproducable on Lenovo Thinkpad

yifaneye commented 1 year ago

Hi @jr-dw-dev , thanks for raising this issue up! I will investigate it next weekend!

yifaneye commented 1 year ago

Hi @jr-dw-dev ! I can reproduce your bugs. If I touch it fast (which I have already got used to), it always works as expected. But, if I touch it slowly, it occasionally does not work. That's because there is movement in the touch, resulting in the touch being recognized as dragging the slide sideways.

digitalwert-devs commented 1 year ago

Sorry for responding only now. I have the same problem with clicking fast. But anyways, for us it ended in showing the button, which we originally didn't want to have.

So if I understand you correctly, the event.buttons > 0 should differentiate between dragging and clicking? Then it would probably be cool to implement a certain number of pixels which need to be moved to make it a swipe, anything under that could be a click.

digitalwert-devs commented 7 months ago

Are there any updates about this problem? It#s been more than a year now..