summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-04-02 19:56:47 -0700
committerJustin R. Miller <incanus@codesorcery.net>2015-04-02 19:56:47 -0700
commit0a736c3a76e3594c12868ed9dd5f1d8da3ca8050 (patch)
treeb8cc51621fa8eb11174dbe6f12326f9b617f1834
parentba5a04e81c56b127c3e06e95d549402ea5131991 (diff)
downloadqtlocation-mapboxgl-0a736c3a76e3594c12868ed9dd5f1d8da3ca8050.tar.gz
fixes #1181: fix lat/lng & zoom ordering problems
-rw-r--r--platform/ios/MGLMapView.mm15
-rw-r--r--src/mbgl/map/map.cpp2
2 files changed, 11 insertions, 6 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 962e3a1126..a3c25f267f 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -46,8 +46,9 @@ NSString *const MGLDefaultStyleName = @"Emerald";
NSString *const MGLStyleVersion = @"v7";
NSString *const MGLDefaultStyleMarkerSymbolName = @"default_marker";
-NSTimeInterval const MGLAnimationDuration = 0.3;
+const NSTimeInterval MGLAnimationDuration = 0.3;
const CGSize MGLAnnotationUpdateViewportOutset = {150, 150};
+const CGFloat MGLMinZoom = 3;
NSString *const MGLAnnotationIDKey = @"MGLAnnotationIDKey";
@@ -1129,7 +1130,9 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
{
CGFloat duration = (animated ? MGLAnimationDuration : 0);
- mbglMap->setLatLng(coordinateToLatLng(coordinate), secondsAsDuration(duration));
+ mbglMap->setLatLngZoom(coordinateToLatLng(coordinate),
+ fmaxf(mbglMap->getZoom(), MGLMinZoom),
+ secondsAsDuration(duration));
[self notifyMapChange:@(animated ? mbgl::MapChangeRegionDidChangeAnimated : mbgl::MapChangeRegionDidChange)];
}
@@ -1168,7 +1171,9 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
CGFloat duration = (animated ? MGLAnimationDuration : 0);
- mbglMap->setZoom(zoomLevel, secondsAsDuration(duration));
+ mbglMap->setLatLngZoom(mbglMap->getLatLng(),
+ fmaxf(zoomLevel, MGLMinZoom),
+ secondsAsDuration(duration));
[self unrotateIfNeededAnimated:animated];
@@ -1738,7 +1743,7 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng)
{
self.showsUserLocation = YES;
- if (self.zoomLevel < 3) [self setZoomLevel:3 animated:YES];
+ if (self.zoomLevel < MGLMinZoom) [self setZoomLevel:MGLMinZoom animated:YES];
if (self.userLocationAnnotationView)
{
@@ -1949,7 +1954,7 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng)
- (BOOL)isRotationAllowed
{
- return (self.zoomLevel > 3);
+ return (self.zoomLevel > MGLMinZoom);
}
// correct rotations to north as needed
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 509986a6d2..09e6b08a1e 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -470,7 +470,7 @@ void Map::setLatLng(LatLng latLng, Duration duration) {
}
LatLng Map::getLatLng() const {
- return state.getLatLng();
+ return transform.getLatLng();
}
void Map::resetPosition() {