Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

-setZoomLevel: should increase maximum zoom level if necessary #3842

Closed
1ec5 opened this issue Feb 6, 2016 · 11 comments
Closed

-setZoomLevel: should increase maximum zoom level if necessary #3842

1ec5 opened this issue Feb 6, 2016 · 11 comments
Labels
archived Archived because of inactivity iOS Mapbox Maps SDK for iOS

Comments

@1ec5
Copy link
Contributor

1ec5 commented Feb 6, 2016

-[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

@1ec5 1ec5 added the iOS Mapbox Maps SDK for iOS label Feb 6, 2016
@ansis
Copy link
Contributor

ansis commented Feb 9, 2016

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?

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 9, 2016

-setMaximumZoomLevel: should control the maximum zoom level for gestures only; under the hood, both -setMaximumZoomLevel: and -setZoomLevel: could cause mbgl::Map::setMaxZoom() to be called.

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 mbgl::Map::setMaxZoom() to be higher than the maximum gesture zoom level (the one that’d be stored as an ivar in MGLMapView and exposed as -maximumZoomLevel).

@friedbunny
Copy link
Contributor

“rubber band” effect when using gestures to rotate, tilt, or zoom past the allowable limits

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.

@bleege
Copy link
Contributor

bleege commented Feb 11, 2016

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?

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 11, 2016

@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.

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 11, 2016

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.

@ansis
Copy link
Contributor

ansis commented Feb 11, 2016

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.

If you call setMaximumZoomLevel from setZoomLevel, wouldn't the user be allowed to zoom to z18 with their fingers after the developer sets the zoom to z18? that's the part I find weird.

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 mbgl::Map::setMaxZoom() to be higher than the maximum gesture zoom level (the one that’d be stored as an ivar in MGLMapView and exposed as -maximumZoomLevel).

Yeah, that sounds good. I'm not that familiar with the iOS sdk, but maybe for gestures you can use an internal setZoom that ignore's the sdk's maxzoom but still have the externally exposed setZoom still clamp to the sdk's maxzoom.

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 11, 2016

If you call setMaximumZoomLevel from setZoomLevel, wouldn't the user be allowed to zoom to z18 with their fingers after the developer sets the zoom to z18? that's the part I find weird.

The SDK would maintain its own maximumZoomLevel field for gestures and always constrain against that. We’ve already got requests for limiting the latitude and longitude in the same way.

@ansis
Copy link
Contributor

ansis commented Feb 11, 2016

The SDK would maintain its own maximumZoomLevel field for gestures and always constrain against that. We’ve already got requests for limiting the latitude and longitude in the same way.

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.

@1ec5
Copy link
Contributor Author

1ec5 commented Feb 11, 2016

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.

@stale stale bot added the archived Archived because of inactivity label Nov 19, 2018
@stale
Copy link

stale bot commented Nov 19, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Nov 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

4 participants