summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2016-01-27 12:06:05 -0800
committerAnsis Brammanis <brammanis@gmail.com>2016-01-28 15:10:26 -0800
commitb738087080b924061c4e6ce4c8b60ae4573f4f10 (patch)
tree9679a73b57d8ccfbd67a01c34950288d28ba294c
parent371a210be877e21ad6564f739d1c5f3ef7f3c532 (diff)
downloadqtlocation-mapboxgl-b738087080b924061c4e6ce4c8b60ae4573f4f10.tar.gz
[osx] setMaximumZoomLevel, setMinimumZoomLevel
adds: setMaximumZoomLevel setMinimumZoomLevel and makes `maximumZoomLevel` and `minimumZoomLevel` not readonly
-rw-r--r--include/mbgl/osx/MGLMapView.h30
-rw-r--r--platform/osx/src/MGLMapView.mm10
2 files changed, 33 insertions, 7 deletions
diff --git a/include/mbgl/osx/MGLMapView.h b/include/mbgl/osx/MGLMapView.h
index 62a689fa19..ca55ba7cd5 100644
--- a/include/mbgl/osx/MGLMapView.h
+++ b/include/mbgl/osx/MGLMapView.h
@@ -182,13 +182,29 @@ IB_DESIGNABLE
*/
@property (nonatomic) double zoomLevel;
-/** The minimum zoom level that can be displayed by the receiver using the
- current style. */
-@property (nonatomic, readonly) double maximumZoomLevel;
-
-/** The maximum zoom level that can be displayed by the receiver using the
- current style. */
-@property (nonatomic, readonly) double minimumZoomLevel;
+/**
+ * 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;
/** Changes the zoom level of the map and optionally animates the change.
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index fe95427e52..96144d964f 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -900,6 +900,16 @@ public:
[self didChangeValueForKey:@"centerCoordinate"];
}
+- (void)setMinimumZoomLevel:(double)minimumZoomLevel
+{
+ _mbglMap->setMinZoom(minimumZoomLevel);
+}
+
+- (void)setMaximumZoomLevel:(double)maximumZoomLevel
+{
+ _mbglMap->setMaxZoom(maximumZoomLevel);
+}
+
- (double)maximumZoomLevel {
return _mbglMap->getMaxZoom();
}