diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2016-01-27 11:34:12 -0800 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2016-01-28 15:10:26 -0800 |
commit | 371a210be877e21ad6564f739d1c5f3ef7f3c532 (patch) | |
tree | 131dc1a0e74f21ffc4fa7478c5a38aa33d571fc3 | |
parent | ca0099b6a439a140316a09d8d44aaa2803f3de35 (diff) | |
download | qtlocation-mapboxgl-371a210be877e21ad6564f739d1c5f3ef7f3c532.tar.gz |
[ios] getters, setters for minZoom, maxZoom
adds:
minimumZoomLevel
setMinimumZoomLevel
maximumZoomLevel
setMaximumZoomLevel
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | include/mbgl/ios/MGLMapView.h | 24 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 20 |
3 files changed, 46 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 45eedeb6f5..822028f4c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,8 @@ Known issues: - Fixed crash caused by MGLAnnotationImage with non-integer width or height ([#2198](https://github.com/mapbox/mapbox-gl-native/issues/2198)) - Fixed “include of non-modular header” errors in Swift projects managed by CocoaPods. ([#3679](https://github.com/mapbox/mapbox-gl-native/pull/3679)) - Avoids triggering the blue background location status bar when user has granted "when in use" permission. ([#3671](https://github.com/mapbox/mapbox-gl-native/issues/3671)) +- Added new methods to MGLMapView for getting and setting the minimum and maximum zoom levels: `minimumZoomLevel`, `setMinimumZoomLevel`, `maximumZoomLevel`, `setMaximumZoomLevel`. ([#509](https://github.com/mapbox/mapbox-gl-native/issues/509)) +- The default `maximumZoomLevel` changed from 18 to 20. ## iOS 3.0.1 diff --git a/include/mbgl/ios/MGLMapView.h b/include/mbgl/ios/MGLMapView.h index b27db4976a..bd4b048d64 100644 --- a/include/mbgl/ios/MGLMapView.h +++ b/include/mbgl/ios/MGLMapView.h @@ -464,6 +464,30 @@ IB_DESIGNABLE - (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated; /** + * The minimum zoom level at which the map can be shown. + * + * Depending on the map view’s aspect ratio, the map view may be prevented + * from reaching the minimum zoom level, in order to keep the map from + * repeating within the current viewport. + * + * If the value of this property is greater than that of the + * maximumZoomLevel property, the behavior is undefined. + * + * The default minimumZoomLevel is 0. + */ +@property (nonatomic) double minimumZoomLevel; + +/** + * The maximum zoom level the map can be shown at. + * + * If the value of this property is smaller than that of the + * minimumZoomLevel property, the behavior is undefined. + * + * The default maximumZoomLevel is 20. + */ +@property (nonatomic) double maximumZoomLevel; + +/** The heading of the map, measured in degrees clockwise from true north. The value `0` means that the top edge of the map view corresponds to true diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index e301686419..954fc8a935 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1784,6 +1784,26 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) MGLDurationInSeconds(duration)); } +- (void)setMinimumZoomLevel:(double)minimumZoomLevel +{ + _mbglMap->setMinZoom(minimumZoomLevel); +} + +- (double)minimumZoomLevel +{ + return _mbglMap->getMinZoom(); +} + +- (void)setMaximumZoomLevel:(double)maximumZoomLevel +{ + _mbglMap->setMaxZoom(maximumZoomLevel); +} + +- (double)maximumZoomLevel +{ + return _mbglMap->getMaxZoom(); +} + - (MGLCoordinateBounds)visibleCoordinateBounds { return [self convertRect:self.bounds toCoordinateBoundsFromView:self]; |