-
Notifications
You must be signed in to change notification settings - Fork 307
-
Notifications
You must be signed in to change notification settings - Fork 307
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
onDragStart direction is 0 instead of 1 or -1 #614
Comments
Please provide a demo, reading code is way too consuming for me as a maintainer. When the drag starts there's no reason why you would have a direction right from the start since it's a mouse down. The only case is when using the threshold / filterTaps options but even then it's debatable whether the first drag event should have a direction at all. |
Sandbox: https://codesandbox.io/s/focused-shannon-2s2j93 Try moving cards left and right lots of times, eventually you'll get some Apparently when you add the |
I have more or less the same scenario. I am in Now if i try to |
@fabyeah sorry for the late reply. i don't have any However, when you use one of the options aforementioned, the lib waits until you've made enough movement so that it can determine whether the drag matches the option. Here the example you sent over uses the Internally, the DragEngine uses some |
In hindsight and after looking through the code I hardly see why you would get state.direction equal to [0, 0] when a movement has been made. In fact, I can't even reproduce this. The direction is calculated through the delta, which itself is calculated from the offset, which is calculated from movement. To clarify, would you be able to show me a video showing the logs on your browser? I'd like to clarify something. Thanks. |
Screen.rec.mp4 |
Does this also happen outside of an iframe with the actual browser console? |
Yes, I opened this issue because it happened in my project. |
Happens with both trackpad and mouse? |
Only tried with mouse and with finger on mobile device until now. Tried with trackpad now and seems like the problem doesn't occur there. |
Interesting. Thanks for your input. I'll have a look this week end if I can. |
Describe the bug
Same as #32, When dragging, sometimes (when starting the drag fast?) the direction in
onDragStart
is [0,0] instead of [1,0] or [-1,0].Here is a log of the
state
var fromonDragStart
when it happens:So
direction
is [0,0], but_direction
is [-1,0]. I will switch to using that variable for now, hopefully without problems.There was an x value logged, so not sure why it doesn't set direction correctly.
Information:
Checklist:
touch-action: none
to the draggable element.The text was updated successfully, but these errors were encountered: