Cuberto / mouse-follower

A powerful javascript library to create amazing and smooth effects for the mouse cursor on your website.
MIT License
724 stars 60 forks source link

Change 'mousemove' to 'pointermove' #12

Closed nurpais closed 1 year ago

nurpais commented 1 year ago

I've had some lags when working with sliders, especially when I'm dragging a slider. The lags disappeared when I changed 'mousemove' to 'pointermove'.

There were lags when working with swiper and flickity sliders. I haven't tested it on the other sliders.

https://user-images.githubusercontent.com/25268319/188215522-1e6f42ae-f1d8-4bd5-a619-db67f14bc6d8.mov

https://user-images.githubusercontent.com/25268319/188215531-5e75defd-a239-4926-9300-e0eb1913d863.mov

Drafteed commented 1 year ago

There were lags when working with swiper and flickity sliders. I haven't tested it on the other sliders.

This happens because these libraries use mousemove event and calls stopPropagation() / preventDefault(). If they used instead of pointermove it would be the same with your changes.

Possible workaround with Swiper using: touchMoveStopPropagation touchStartPreventDefault touchStartForcePreventDefault

nurpais commented 1 year ago

@Drafteed thank you!

ngdot commented 3 weeks ago

@nurpais , did you get this work on anyway without changing the source code?

arnojong commented 3 weeks ago

@ngdot Adding touchStartPreventDefault = false to my (swiper) slider made it work.