Re: Combining pan, zoom, and rotate gestures into one?
Re: Combining pan, zoom, and rotate gestures into one?
- Subject: Re: Combining pan, zoom, and rotate gestures into one?
- From: David Duncan <email@hidden>
- Date: Sat, 15 Jun 2013 09:14:43 -0700
On Jun 14, 2013, at 5:41 PM, Rick Mann <email@hidden> wrote:
> The Apple Maps application allows you to pan, zoom, and rotate in a single two-finger gesture.
>
> Is that done with three gesture recognizers all operating simultaneously? Or are they just handling the touches directly?
>
> I don't see how to get a combined transform out of the three separate gesture recognizers.
What I've found in the past is it is actually far simpler to create a single gesture recognizer that emits a combined transform rather than trying to combine (and maintain) 3 gesture recognizers.
If you have two touches then you can generate all of this from that interaction:
1) Translation comes from watching how the center point moves between the original touches and the current touches
2) Scale comes from the change in distance between the touches
3) Rotation comes from the angle between the vectors formed by the original touches and current touches. To do this you just appoint a touch as the "origin" (it can be arbitrary, I used touch 0) and subtract out to form the vectors.
Rotation & Scale combine in arbitrary order, but you probably want translation to be added in last (since for direct manipulation you likely don't want the translation scaled or rotated).
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden