-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
When the number of touch points changes, unexpected movement occurs #596
Comments
Hm interesting issue. I've been experiencing this as well and thought about a proper way to fix this. Changing deltaX/Y to the primary (the first) touch would solve these issues. But the first touch doesnt have to be the last touch, thus not primary anymore, and then it's jumping again... I guess that the changing the center position to stay at the relative position after a touch is released should fix the jumping around of the values. I will look into this today, i think this issue is a serious one! |
The problem of tracking deltaXY for the primary touch is that that primary touch might change, i.e. going from drag with finger 1 to rotation with fingers 1 and 2 to drag with finger 2. In this case you'd need to switch to tracking deltaXY on the second finger which might cause the jump to occur. Also I'm not sure it would work well when trying to detect a two finger drag at the same time with rotation. Probably to some extent there will be need to track the gesture center, but detect when touches get added/removed and this causes a shift in the center and don't count those in. Edit: Reading your comment more carefully it looks like I've mostly re-iterated what you already wrote :O) |
Maybe tracking relative deltas for each finger could work. I.e. track the change/delta for each finger since the previous deltaXY update and take the average. The important bit is that the delta for each finger would be relative deltas since the previous calculation, and thus wouldn't maybe get skewed as fingers are added and removed. |
I think i've fixed it: b29ea29 |
With the current version, I'm seeing the rotation go completely 180 if I lift one fingers after a combined pinch-rotation. Steps to reproduce:
|
With a mouse doing the following: mouse down, move, stop for 1s, mouse up -> always non-zero velocity. As the mouse pointer wasn't moving for 1s, I would expect zero velocity. |
Testing was done on ace519d “Fix rotate” version in git. |
The rotation issue I'm seeing is likely this one: #610 |
Could create a new issue for #596 (comment)? |
Ok: #620 |
It is difficult to verify if this original issue is now fixed or not. The issues #620, #596 and #610 are the current problems I'm seeing, but they make it difficult to see if there is jumping in the delta values. Perhaps it is best to close this for now, and I can re-open it if I'm still seeing it after the three other bugs are fixed. |
👍 |
I'm having issue even with v2.04 in iOS devices. I managed to do a work around for this issue using code below, just for temporary measure: |
morph85: Thanks for writing that there are still bugs. We are using the old 1.x branch which doesn't have this bug. |
I'm still seeing deltaX/deltaY jumps with 2.0.4 (Android Chrome, iOS Safari). If you are panning with one finger and you add another finger later (for multitouch panning, pinching etc.) there are unexpected deltaX/deltaY changes. EDIT |
I noticed that when the user changes from using two touches for rotation to one touch, dragging, the deltaX and deltaY and velocities jump.
From a usage perspective when doing panning, if the persons fingers don't move, it would be expected that the surface below doesn't move, even if they lift a finger from the screen. However I assume that because the center of the gesture moves, this causes deltaX and deltaY to change which in turn causes a velocity to be generated.
I've worked around the deltaXY changing by detecting when the number of touches changes, or when the finger identifier changes, and compensating for the jump in deltaXY but I haven't figured out how to compensate for the velocity.
Using Hammer.js would be easier if the deltaX, deltaY and velocities would relate to the user's fingers moving on screen, rather than the center point of the gesture changing. Tracking the center point moving does work, but only when the number of touches remains constant through the gesture.
The text was updated successfully, but these errors were encountered: