First of all i should say my app is already has pinch zoom which works perfectly and it has pan feature too but this pan feature works with single touch and i want to make both work with multi touch. What i mean is if user make pinch gesture zoom work should be done and if user move both finger in same direction then pan work would be done. I have tried to use a threshold approach which measures the distance between fingers and compare the distance with previous distance and if the difference between distances is less than threshold it act as pan and if the difference is bigger than threshold then it acts as zoom. This approach kind of works but it is inconsistent. So i am here to ask for smarter and smoother way to make work this.

PS: My pinch zoom code is from here

有帮助吗?

解决方案

The best approach that I can think of is by using the direction of movement. If the two fingers move in different directions, then activate only the zoom. But if they move in the same direction, pan and check for zoom based on the threshold. This should add some consistency.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top