From fc576ddef67e15027d027bdc486b0723b8383af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 5 May 2015 12:02:47 -0400 Subject: [PATCH] Suppressed an uninitialized value warning from the static analyzer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- platform/ios/MGLMapView.mm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 6c4875546..3ea7c0cec 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));