-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add setters, getters for map's minZoom and maxZoom #3712
Conversation
@@ -404,6 +404,30 @@ IB_DESIGNABLE | |||
- (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated; | |||
|
|||
/** | |||
* The minimum zoom level the can be shown at. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“the map can be”
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s worth noting here that the minimum zoom level can still be constrained regardless of this property to prevent showing multiple copies of the world at the same time. This is relevant whenever the view is much wider than it is tall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how would you phrase this in the documentation? I'm having trouble coming up with a clear explanation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect, thanks
@friedbunny @boundsj, should these properties be made inspectable in Interface Builder? Or would it be confusing that setting the minimum zoom level to 0 won’t necessarily allow the user to zoom out to z0 if the view is wide enough? |
What happens if the map is already at z0 when the minimum zoom level is set to z2? It seems like the map would suddenly snap to z2 as soon as you touch it. We should look into handling this special case at the SDK level by first animating to the new minimum zoom level then officially setting that minimum. In any case, once the comments above are addressed, this PR will be good to go from my perspective. |
It will immediately snap to z2 when the new minimum zoom is set: 196feb9#diff-fd1625168ba48a6fb963e63343c0ac59R308 I think immediately jumping is fine since this isn't something you would usually call during use. With easing you'd have to worry about:
|
When it comes to properties like this, on iOS and OS X, we’ve provided additional setters like
The minimum or maximum zoom level would be set inside the
In that case, I’m fine with the behavior you’ve implemented. 👍 |
Thanks for the background on animated setters and transitions @1ec5. Good to know! |
I vote... yes? (Halfheartedly.) That said, most of the zoom-related requests we've seen are related to bumping the maximum value, but if we continue to default to the effective maximum then that'd be satisfactory there. |
That’s a good point. Let’s revisit the inspectable idea later if the use cases become clear. |
@ansis About this:
This will match the 4.0.0 release, where we are probably going to expose this as a configuration in a builder pattern. The developer will not be able to change the behaviour after the map is created. |
also change the default maxZoom to 20 to match -js.
adds: map.getMminZoom(); map.setMminZoom(double); map.getMaxZoom(); map.setMaxZoom(double);
adds: minimumZoomLevel setMinimumZoomLevel maximumZoomLevel setMaximumZoomLevel
adds: setMaximumZoomLevel setMinimumZoomLevel and makes `maximumZoomLevel` and `minimumZoomLevel` not readonly
Tracked in #4388. |
fixes #509