views:

339

answers:

2

Hi All,

I am using the .net 4 beta 2 touch libraries, and Im trying to implement a zooming feature in my WPF application.

I can get the zooming working just fine, but what I want is to zoom in on the center of the pinch gesture, and I cannot see anything in the API's about how to accomplish this.

Is there some methods or properties that expose the 2 contacts being using in the pinch gesture so that I can get the center of them?

EDIT:

I just investigated using the GetIntermediateTouchPoints method of TouchEventArgs which did not seem to give me what I want.

Thanks a lot Mark

A: 

Assuming you are using the new TouchXxxxEvent routed events, they all take TouchEventArgs, which has TouchDevice property. If you call its GetTouchPoint() method, you can get the TouchPoint that represents the point of touch.

More details and sample code from Jaime Rodriguez.

Franci Penov
I am using the `TouchDown` event at the moment, but Im using the `ManipulationDelta` for the actual manipulation. I can see the `GetIntermediateTouchPoints` method, which could be what im after here...
Mark
Nope that method does not seem to do what I want, so for now I may have to track the contacts then calculate the distance between the two of them...ugly!
Mark
A: 

Turns out that the properties I was after was right in front of me all along.

the Manipulation2DDeltaEventArgs class has OriginX and OriginX properties that specific the center point of the pinch gesture, so Im just using that and its all good :)

Mark