On Jun 14, 2013, at 5:41 PM, Rick Mann <rm...@latencyzero.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to