diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-05-05 12:02:47 -0400 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-05-05 12:02:47 -0400 |
commit | fc576ddef67e15027d027bdc486b0723b8383af3 (patch) | |
tree | c49b00e051e66627389a49a77cc729368d658d6f /platform | |
parent | 900d140f23b28c56ab01fc227b5cf74a71e81650 (diff) | |
download | qtlocation-mapboxgl-fc576ddef67e15027d027bdc486b0723b8383af3.tar.gz |
Suppressed an uninitialized value warning from the static analyzer
While tracking the user’s location, a double tap not near the user dot now turns off location tracking instead of bouncing between the tapped location and the user location.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLMapView.mm | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 6c48755463..3ea7c0cec0 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -1077,22 +1077,19 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration) { CGPoint doubleTapPoint = [doubleTap locationInView:doubleTap.view]; - CGPoint zoomInPoint; - + CGPoint zoomInPoint = doubleTapPoint; + CGPoint userPoint = [self convertCoordinate:self.userLocation.coordinate toPointToView:self]; if (self.userTrackingMode != MGLUserTrackingModeNone) { - CGPoint userPoint = [self convertCoordinate:self.userLocation.coordinate toPointToView:self]; CGRect userLocationRect = CGRectMake(userPoint.x - 40, userPoint.y - 40, 80, 80); if (CGRectContainsPoint(userLocationRect, doubleTapPoint)) { zoomInPoint = userPoint; } } - else + if ( ! CGPointEqualToPoint(zoomInPoint, userPoint)) { self.userTrackingMode = MGLUserTrackingModeNone; - - zoomInPoint = doubleTapPoint; } _mbglMap->scaleBy(2, zoomInPoint.x, zoomInPoint.y, secondsAsDuration(MGLAnimationDuration)); |