Skip to content

Gesture with wheel and drag bugs drag bounds. #329

Answered by dbismut
danielx-art asked this question in Q&A
Discussion options

You must be logged in to vote

A few things worth noticing: there's no need to use the useCallback hook for handlers. The useGesture hook is recomputed on every render whether the handler function reference changes or not. In that case it just adds complexity and a if / else condition relying on event.type which is not always safe with this lib.

Here's a working sandbox (at least I think in my rapid testing): https://codesandbox.io/s/dreamy-sound-wutk2
I haven't used rollSpeed as this is typically the sort of complexity overload that I don't want to deal with when solving issues.

Working on this sandbox makes me realize that there might be something to be done to make bounds work better when wheel is changing direction…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danielx-art
Comment options

Answer selected by danielx-art
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants