-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-setZoomLevel: should increase maximum zoom level if necessary #3842
Comments
I disagree. It seems weird to me that a setZoomLevel call would change how far you can zoom in with gestures. If changing the max zoom level is intentional it's easy to call a separate method but if it's not intentional the max zoom level change could be a weird surprise. Is there any precedent in other mapping libraries for this kind of behavior? |
Sort of. MapKit has no configurable maximum zoom level, but it does enforce various limits on rotation and pitch – except when setting those properties programmatically. So at the lowest zoom levels, you can rotate the map 90° programmatically but not via gestures. More practically, MapKit has a “rubber band” effect when using gestures to rotate, tilt, or zoom past the allowable limits. To implement this effect, we’d need the maximum programmatic zoom level (the one passed into |
Yeah, doing this in MBGL or the iOS SDK (tilt → #2191) is going to require us to artificially limit the maximum gestural zoom/tilt/etc by a few factional-zooms/degrees/etc. |
I tend to agree with @ansis on this one. If someone has set a max zoom level and then "violates it" later via setZoom that seems more like a programming error. What's the point of having a max zoom level then? |
@bleege, on iOS, I think we'll eventually need to distinguish between limits imposed on gestures versus limits imposed across the board. It isn't a violation for the developer to zoom in to z18 but only allow the user to get to z16 with their fingers. What I'm getting at is that the maximumZoomLevel property exposed by the SDK should be part of our gesture handling code and should have little to do with the source. |
I'm pretty sure any change within the scope of this issue would be limited to the iOS and OS X SDK code; if the behavior I'm describing has no place on Android, there should be no effect on that SDK whatsoever. |
If you call
Yeah, that sounds good. I'm not that familiar with the iOS sdk, but maybe for gestures you can use an internal |
The SDK would maintain its own |
Oh, I was misunderstanding. So basically the sdk max zoom level would only apply to gestures and the core max zoom would always be 25.5. What happens when a gesture is initiated when the map is at z18 and maxzoom is z16? Same question for latlng constraints and panning. |
Ideally, it’d quickly animate to the gestural limit, but I think even MapKit snaps immediately to the limit. |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
-[MGLMapView setZoomLevel:]
is currently clamped to the minimum and maximum zoom levels. In general, however, MGLMapView generally uses properties like that to restrict user activity, such as to prevent the user from pinching in past the maximum zoom level, not to restrict programmatic use. If a higher-than-maximum value is passed into-setZoomLevel:
, that’s pretty intentional, and MGLMapView should respect that value (up to the hard limit of 25.5) by increasing the maximum zoom level./ref #3712
/cc @ansis @friedbunny @bleege
The text was updated successfully, but these errors were encountered: