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

Moved MGLAltitudeForZoomLevel and MGLZoomLevelForAltitude to public API - #12986

Merged
d-prukop merged 2 commits into
masterfrom
5583-zoom-altitude-conversion
Oct 1, 2018
Merged

d-prukop merged 2 commits into
masterfrom
5583-zoom-altitude-conversion

Conversation

@d-prukop

@d-prukop d-prukop commented Sep 28, 2018 •

Copy link
Copy Markdown
Contributor

@d-prukop d-prukop added feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Sep 28, 2018

@fabian-guerra fabian-guerra left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this change. What are your thoughts on making this part of MGLMapCamera with an api that sets/returns the current distance/zoom I'm thinking that the main use case is either "zoom in/out" a camera without making a new one(?), or what are the use cases that this change is going to address?

cc @1ec5 @friedbunny @julianrex

@julianrex

Copy link
Copy Markdown
Contributor

These don't require an MGLMapCamera thought right? If they need some kind of namespace (which I don't think they do), we could consider class methods.

@d-prukop

Copy link
Copy Markdown
Contributor Author

I think this is OK outside of MGLMapCamera. As @julianrex said, it doesn't require MGLMapCamera and MGLMapCamera doesn't use or need zoom level.
With these methods public I can abandon using the private property isAltitudeAffectedByPitch from #12938.
The way I'm using this is to get the altitude I need to frame the route line from MGLMapView cameraThatFitsShape then I can adjust this camera as needed and set it on the mapView. The problem is that this still exhibits the issue from the 'before' animation on that ticket. The way I'm solving this is to immediately set the zoomLevel property on the mapView right after setCamera
Since there is no direct property for altitude on the mapView, I need to convert the altitude to a zoomLevel.
I also have switched my code over to using zoom levels since this will make it easier to control the visuals with regards to the map style.

/cc @fabian-guerra @1ec5 @julianrex

@fabian-guerra

Copy link
Copy Markdown
Contributor

I may be wrong by saying MGLMapCamera. What I am trying to say is if we can instead of providing 'raw' functions what about a "camera object/manager/controller" where we can set the distance/animation curves/etc to gain finer control of the camera (or perhaps both). As I understand the reason behind moving this into the public is mainly to help in the camera animations.

I am OK with this being public but was considering if we can provide an api with finer control instead.

@d-prukop

Copy link
Copy Markdown
Contributor Author

@fabian-guerra 100% agree that we need that. This is baby steps... and we need this soon.

@1ec5 1ec5 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that there’s more we can do in this department, but this is a reasonable and useful function and not all that surprising an API design. It’s quite an improvement over #12938 and complements #12966. Future efforts can build on this function using composition. For example, a conversion between viewing distance and zoom level would be pretty straightforward and also helpful for certain use cases.

@fabian-guerra fabian-guerra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants