diff options
author | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-03-08 12:43:05 +0200 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-03-14 18:33:11 +0200 |
commit | 57334407473a31ff43baa645dafd2f5e1bd910fb (patch) | |
tree | e981f87c0040799a1ebc45f86d05b3ece6916aba /platform/macos | |
parent | 11de777628e9e2c4b219bae3f1a6eabd86f2a3c5 (diff) | |
download | qtlocation-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/macos')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 054b91d44c..320abf740c 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -328,7 +328,7 @@ public: mbgl::CameraOptions options; options.center = mbgl::LatLng(0, 0); options.padding = MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets); - options.zoom = _mbglMap->getMinZoom(); + options.zoom = *_mbglMap->getBounds().minZoom; _mbglMap->jumpTo(options); _pendingLatitude = NAN; _pendingLongitude = NAN; @@ -1094,21 +1094,21 @@ public: - (void)setMinimumZoomLevel:(double)minimumZoomLevel { MGLLogDebug(@"Setting minimumZoomLevel: %f", minimumZoomLevel); - _mbglMap->setMinZoom(minimumZoomLevel); + _mbglMap->setBounds(mbgl::BoundOptions().withMinZoom(minimumZoomLevel)); } - (void)setMaximumZoomLevel:(double)maximumZoomLevel { MGLLogDebug(@"Setting maximumZoomLevel: %f", maximumZoomLevel); - _mbglMap->setMaxZoom(maximumZoomLevel); + _mbglMap->setBounds(mbgl::BoundOptions().withMaxZoom(maximumZoomLevel)); } - (double)maximumZoomLevel { - return _mbglMap->getMaxZoom(); + return *_mbglMap->getBounds().maxZoom; } - (double)minimumZoomLevel { - return _mbglMap->getMinZoom(); + return *_mbglMap->getBounds().minZoom; } /// Respond to a click on the zoom control. |