diff options
author | Kirill Zhdanovich <kzhdanovich@gmail.com> | 2013-03-01 15:51:34 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:51:31 +0300 |
commit | c68e1b3ad3ffe2144150f0572536a28ffb1c5946 (patch) | |
tree | b43aa523ffe40f4f608de7f95ef88636f14b3ff6 /iphone | |
parent | 494e1dc4065bcbb55e020fcc5aa0e494817f70e2 (diff) |
[iOS] Recognizers update
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/Classes/MapViewController.mm | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index ddce85c1b6..f5d2206965 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -463,7 +463,12 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { - return YES; + if ([otherGestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]] + || [otherGestureRecognizer isKindOfClass:[UIRotationGestureRecognizer class]]) + { + return YES; + } + return NO; } -(void)addGestures @@ -635,14 +640,23 @@ { if (recognizer.numberOfTouches >1 ) { - p1 = [recognizer locationOfTouch:0 inView:self.view]; - p2 = [recognizer locationOfTouch:1 inView:self.view]; + CGPoint t1 = [recognizer locationOfTouch:0 inView:self.view]; + CGPoint t2 = [recognizer locationOfTouch:1 inView:self.view]; + CGFloat const scaleFactor = self.view.contentScaleFactor; - p1.x *= scaleFactor; - p1.y *= scaleFactor; - p2.x *= scaleFactor; - p2.y *= scaleFactor; + t1.x *= scaleFactor; + t1.y *= scaleFactor; + t2.x *= scaleFactor; + t2.y *= scaleFactor; + //avoid jumping if user scales or rotates with one finger fixed + if (startedScaling && CFAbsoluteTimeGetCurrent() - lastRotateTime > 0.1) + { + GetFramework().StartScale(ScaleEvent(t1.x, t1.y, t2.x, t2.y)); + lastRotateTime = CFAbsoluteTimeGetCurrent(); + } + p1 = t1; + p2 = t2; } } |