You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement some drag and drop code with long press on mobile devices. I'm not sure if this is a bug or something I'm doing wrong, but I'll try to explain as best as I can:
I'm using @react-spring/web version 9.7.3 and @use-gesture/react version 10.3.1. my code should be fairly standard stuff taken straight from the examples, the only difference is a timer which starts onTouchStart. if the user moves a certain offset before the timer ends, I call cancel(). after calling cancel, if I move after the long press, my div "jumps" to the last offset. i.e.:
I move after the timer from [ 0, 0 ] to offset [ 60, 20 ]
offset is [ 60, 20 ], lastOffset is [ 0, 0 ]
I move before the timer to [ 70, 100 ] and my gesture is canceled()
offset is [ 70, 100 ], lastOffset is [ 60, 20 ]
I move after the timer
offset is [ 70, 100 ], lastOffset is [ 70, 100 ]
so basically what I see is my div jumping from [ 60, 20 ]. to [ 70, 100 ]. since I canceled that gesture, I expect to have a new gesture having offset equal to [ 60, 20 ], where my div is currently positioned.
The reason I use offset is because react-spring is moving the div with transform: translate3d();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to implement some drag and drop code with long press on mobile devices. I'm not sure if this is a bug or something I'm doing wrong, but I'll try to explain as best as I can:
I'm using
@react-spring/web
version 9.7.3 and@use-gesture/react
version 10.3.1. my code should be fairly standard stuff taken straight from the examples, the only difference is a timer which startsonTouchStart
. if the user moves a certain offset before the timer ends, I callcancel()
. after calling cancel, if I move after the long press, my div "jumps" to the last offset. i.e.:cancel
ed()so basically what I see is my div jumping from [ 60, 20 ]. to [ 70, 100 ]. since I canceled that gesture, I expect to have a new gesture having offset equal to [ 60, 20 ], where my div is currently positioned.
The reason I use
offset
is because react-spring is moving the div withtransform: translate3d();
Any way to solve this?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions