summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-03-08 12:43:05 +0200
committerAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-03-14 18:33:11 +0200
commit57334407473a31ff43baa645dafd2f5e1bd910fb (patch)
treee981f87c0040799a1ebc45f86d05b3ece6916aba /platform/ios
parent11de777628e9e2c4b219bae3f1a6eabd86f2a3c5 (diff)
downloadqtlocation-mapboxgl-57334407473a31ff43baa645dafd2f5e1bd910fb.tar.gz
[core] Group Map LatLngBounds, min and max zoom methods
Group bounds, minimum and maximum zoom related methods together using the new BoundOptions. v2: Document that getBounds() initializes all optional fields. - Add test for getBounds() on a map with default values.
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/src/MGLMapView.mm16
1 files changed, 8 insertions, 8 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index f393dec0c1..692da30f04 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1661,7 +1661,7 @@ public:
newScale += scale / (velocity * duration) * 0.1;
}
- if (newScale <= 0 || log2(newScale) < self.mbglMap.getMinZoom())
+ if (newScale <= 0 || log2(newScale) < *self.mbglMap.getBounds().minZoom)
{
velocity = 0;
}
@@ -1927,7 +1927,7 @@ public:
if ( ! self.isZoomEnabled) return;
- if ([self zoomLevel] == self.mbglMap.getMinZoom()) return;
+ if ([self zoomLevel] == *self.mbglMap.getBounds().minZoom) return;
[self cancelTransitions];
@@ -1979,7 +1979,7 @@ public:
{
CGFloat distance = [quickZoom locationInView:quickZoom.view].y - self.quickZoomStart;
- CGFloat newZoom = MAX(log2f(self.scale) + (distance / 75), self.mbglMap.getMinZoom());
+ CGFloat newZoom = MAX(log2f(self.scale) + (distance / 75), *self.mbglMap.getBounds().minZoom);
if ([self zoomLevel] == newZoom) return;
@@ -3251,23 +3251,23 @@ public:
- (void)setMinimumZoomLevel:(double)minimumZoomLevel
{
MGLLogDebug(@"Setting minimumZoomLevel: %f", minimumZoomLevel);
- self.mbglMap.setMinZoom(minimumZoomLevel);
+ self.mbglMap.setBounds(mbgl::BoundOptions().withMinZoom(minimumZoomLevel));
}
- (double)minimumZoomLevel
{
- return self.mbglMap.getMinZoom();
+ return *self.mbglMap.getBounds().minZoom;
}
- (void)setMaximumZoomLevel:(double)maximumZoomLevel
{
MGLLogDebug(@"Setting maximumZoomLevel: %f", maximumZoomLevel);
- self.mbglMap.setMaxZoom(maximumZoomLevel);
+ self.mbglMap.setBounds(mbgl::BoundOptions().withMaxZoom(maximumZoomLevel));
}
- (double)maximumZoomLevel
{
- return self.mbglMap.getMaxZoom();
+ return *self.mbglMap.getBounds().maxZoom;
}
- (MGLCoordinateBounds)visibleCoordinateBounds
@@ -5847,7 +5847,7 @@ public:
- (CGFloat)currentMinimumZoom
{
- return fmaxf(self.mbglMap.getMinZoom(), MGLMinimumZoom);
+ return fmaxf(*self.mbglMap.getBounds().minZoom, MGLMinimumZoom);
}
- (BOOL)isRotationAllowed