开发者

How to implement both pinch zoom and pan with multitouch?

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开发者_Go百科 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜