Edward
Edward

Reputation: 7424

How to limit Pinch gesture in Silverlight WP7?

I'm implementing the pinch gesture in my application using GestureListener in silverlight. The problem I'm running into is placing a limit on scaling that occurs when a user pinches an object.

In XNA it's pretty straighforward because everytime the update method is call you can check the scale of the object at its current point and determine wheter to increase, decrease, or do nothing with the object.

In Silverlight though I'm trying to check against a limit but my code is only running after the gesture is complete. So the user still has the ability to scale past the limit I set and then it flickers back to the limited scale again after they release the pinch. Anyone know how to impose a limit on the scaling?

Upvotes: 0

Views: 211

Answers (1)

Heinrich Ulbricht
Heinrich Ulbricht

Reputation: 10372

There are three events involved in the pinch gesture:

  • PinchStarted
  • PinchDelta
  • PinchCompleted

Try handling the PinchDelta instead of PinchCompleted to get updates while the user is doing the gesture. Then just refuse to make your object bigger.

Upvotes: 1

Related Questions