views:

73

answers:

1

I want to get the position (relative or otherwise) of the two fingers/touches inside a gesture event (gesturestart, gesturechange, gestureend) on mobile Safari (iOS: iPad/iPhone). I know that the gesture* events don't actually provide this in the event args but i thought there might be a 'trick' to getting this info. It would be great to get the coords of the fingers while tracking a gesture (eg. scaling and moving an object in the same gesture).

Can this be done?

+1  A: 

There are three arrays in the returned event object for touch event:

  1. touches
  2. targetTouches
  3. changedTouches

I can't remember where I originally found this info, but a quick Google search brings up http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/

Got it! http://tuvix.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html Down at "Handling Multi-Touch Events"

Adam Heath
Thanks for the answer. Yeh I've been to those links hey. I'm really after getting the touch array items from inside a gesture event. Now i know the gesture event does not provide these directly but i thought perhaps there was an indirect way to do this?
cottsak
I do not believe so. The guesture events are a higher level event and do not contain this data. If you need this kind of data then you should be using the touch events and the arrays properties mentioned above.Guesture event properties: http://tuvix.apple.com/library/safari/#documentation/UserExperience/Reference/GestureEventClassReference/GestureEvent/GestureEvent.html#//apple_ref/javascript/cl/GestureEvent
Adam Heath