summaryrefslogtreecommitdiff
path: root/platform/ios/src
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-20 00:08:51 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-20 11:02:31 -0800
commit460b21e32475a04aa90b0cbfda70561049a2beca (patch)
treea6b154d6ec139db907f63e638f0ff5fb70f874ff /platform/ios/src
parentbd4611107ddfe0068afb8f6611deb6cec78c6f73 (diff)
downloadqtlocation-mapboxgl-460b21e32475a04aa90b0cbfda70561049a2beca.tar.gz
[ios] z14 initially in user tracking mode
When entering user tracking mode from a low zoom level, zoom in to z14 regardless of the location’s horizontal accuracy.
Diffstat (limited to 'platform/ios/src')
-rw-r--r--platform/ios/src/MGLMapView.mm13
1 files changed, 11 insertions, 2 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index a488c0bd49..3cb8209f1d 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -68,6 +68,13 @@ const NSTimeInterval MGLUserLocationAnimationDuration = 1.0;
const CGSize MGLAnnotationUpdateViewportOutset = {150, 150};
const CGFloat MGLMinimumZoom = 3;
+
+/// Minimum initial zoom level when entering user tracking mode.
+const double MGLMinimumZoomLevelForUserTracking = 10.5;
+
+/// Initial zoom level when entering user tracking mode from a low zoom level.
+const double MGLDefaultZoomLevelForUserTracking = 14.0;
+
const NSUInteger MGLTargetFrameInterval = 1; //Target FPS will be 60 divided by this value
/// Tolerance for snapping to true north, measured in degrees in either direction.
@@ -3095,7 +3102,7 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
if (std::abs(currentPoint.x - correctPoint.x) > 1.0 || std::abs(currentPoint.y - correctPoint.y) > 1.0)
{
- if (round(self.zoomLevel) >= 10)
+ if (self.zoomLevel >= MGLMinimumZoomLevelForUserTracking)
{
// at sufficient detail, just re-center the map; don't zoom
//
@@ -3140,7 +3147,9 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration)
MGLMapCamera *camera = self.camera;
camera.centerCoordinate = self.userLocation.location.coordinate;
camera.heading = course;
- camera.altitude = newLocation.horizontalAccuracy;
+ camera.altitude = MGLAltitudeForZoomLevel(MGLDefaultZoomLevelForUserTracking, camera.pitch,
+ camera.centerCoordinate.latitude,
+ self.frame.size);
__weak MGLMapView *weakSelf = self;
[self _flyToCamera:camera withDuration:animated ? -1 : 0 peakAltitude:-1 completionHandler:^{