Skip to content

Commit

Permalink
Workaround UIPinchGesture number of touch bug (#2025)
Browse files Browse the repository at this point in the history
- Based on the documentation https://developer.apple.com/documentation/uikit/uipinchgesturerecognizer, pinch gesture
state should not be set to "Changed" if "both" fingers are not pressed, which does not seem to be the case.
  • Loading branch information
tallytalwar authored and matteblair committed Jan 31, 2019
1 parent daa500d commit c3ac543
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions platforms/ios/framework/src/TGMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,13 @@ - (void)respondToPinchGesture:(UIPinchGestureRecognizer *)pinchRecognizer
[self setMapRegionChangeState:TGMapRegionJumping];
break;
case UIGestureRecognizerStateChanged:

// NOTE: Based on the documentation https://developer.apple.com/documentation/uikit/uipinchgesturerecognizer,
// Pinch gesture state should not be set to "Changed" if "both" fingers are not pressed, which does not seem to be the case.
// Following a work-around to avoid this bug.
if ([pinchRecognizer numberOfTouches] < 2) {
break;
}
[self setMapRegionChangeState:TGMapRegionJumping];
if ([self.gestureDelegate respondsToSelector:@selector(pinchFocus:recognizer:)]) {
CGPoint focusPosition = [self.gestureDelegate pinchFocus:self recognizer:pinchRecognizer];
Expand Down

0 comments on commit c3ac543

Please sign in to comment.