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
e.center.x & y same as element .left/.top in Hammer.js 2.0 ? #577
Comments
Hammer now just sets to the center of the single touch (thus the coords of your finger) after a multi touch. I am thinking about to change this, to keep it's last relative center position, so the target won't jump around. |
I'm for this as well. After implementing pinch zoom for images I noticed that the image jumps at the end of the interaction. This is because the user doesn't lift both fingers off the display simultaneously. I think from a user experience point of view all mufti touch events should add center offsets when fingers are removed during screen interaction so there's no jumping. Conceptually it makes no sense from what Touch.center should mean (which is currently correct) but I can easily see this modified behavior being the preferred default. Maybe add an additional multiTouchCenter parameter? |
deltaX and deltaY have fixed this issue, and should be used for these kind of things. They hold the relative position. See the demo at the homepage for how it works! |
Using the hammer.js for the same issue.
PS: this example will not allow you to move the element out of the screen |
So, I've run into an issue with the new Hammer.js where, if I rotate an element and release, it flops back and forth (almost like a there is a 180 degree turn happening somewhere). I think I've tracked down the issue to not calculating the center of rotation properly. More specifically, in the previous version of Hammer.js, I was using the following code
and in the new version, I've updated it to the following
Now, where you see the debugger; statements in the dragstart/panstart event handlers, I am seeing in 2.0 that e.center.x/y is always the same as startX/startY, so when I drag an element, it is always being dragged by the top/left corner of the element. Did I not translate this logic properly for 2.0?
The text was updated successfully, but these errors were encountered: