2

I'm trying to figure out how to implement pinch-to-zoom functionality. My problem is I'm not sure how to do it algorithmically.

I have the pinch positions of both fingers and the amount they've moved since the last frame. At first I tried making the pinch amount the delta of the distance between the two fingers however every way I've done it around this concept has been unyieldly.

Even if I manage to get the pinching working semi-decently I still have the problem of the zoom direction and how to make the image zoom in on the center of the pinch area...

Is there a proper way of implementing such functionality?

meds
  • 21,699
  • 37
  • 163
  • 314

3 Answers3

3

I also recommend reading this, a really well implemented "gold standard" pinch:

http://adtsai.blogspot.com/2010/09/pinch-zooming-using-xna4-on-wp7-getting.html

It also makes reference to a pinch to zoom add-in so you can test pinching on the emulator with just a mouse.

Beringela
  • 31
  • 1
2

What you want to do is use the built-in gesture API (specifically Pinch and PinchComplete). That way, you can take advantage of the heuristics that the xna/wp7 team has already built in. Your app will feel "more native" this way because it will react like the rest of the OS in reaction to a pinch gesture.

Nick Gravelyn has a great intro to the gesture API here:
http://blogs.msdn.com/b/nicgrave/archive/2010/07/12/touch-gestures-on-windows-phone-7.aspx

Joel Martinez
  • 46,929
  • 26
  • 130
  • 185
-1

I found few links of 3rd-party solution...

1) Dual-Touch SDK for Resistive Screens V1.0 Beta, Rotation Alpha

2) SciLor's HD2 / Leo Multitouch .NET CF DLL

I tried using Dual-Touch SDKs which were working fine for Resistive screen mobiles but not for Capacitive Screen mobiles.

user001
  • 444
  • 5
  • 10