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

Allow setting a center coordinate with an animation timing function and zoom level #8427

Closed
erichoracek opened this issue Mar 15, 2017 · 1 comment
Labels
iOS Mapbox Maps SDK for iOS

Comments

@erichoracek
Copy link
Contributor

Currently, there is an internal private method for setting a center coordinate with a zoom level and a timing function:

- (void)_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate edgePadding:(UIEdgeInsets)insets zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion;

This method is not exposed publicly. Unfortunately, as far as I can tell, there is no way for a consumer to accomplish what this method allows. Specifically, setting a center coordinate with:

  • A zoom level
  • An animation timing function

The currently available methods that allow timing functions are:

1.:

- (void)setVisibleCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion;

This method does not have a mechanism for setting a zoom level if you provide a single point to center on, so this does not work unfortunately.

2.:

- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function;
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion;

There is no way to initialize a MGLMapCamera with a zoom level, so this does not work either.

Please let me know if I missed something. Thanks!

@boundsj boundsj added iOS Mapbox Maps SDK for iOS support and removed support labels Mar 15, 2017
@boundsj
Copy link
Contributor

boundsj commented Mar 15, 2017

Hi @erichoracek

There is no way to initialize a MGLMapCamera with a zoom level, so this does not work either.

It is possible to to create an MGLMapCamera with an altitude measured in meters. However, as noted in #5583 (and your comment above), there is not currently a way to convert between zoom levels and altitudes.

I've added #5583 to the next Mapbox iOS SDK milestone. In the meantime, you may be able to use a raw altitude value to get nearly the effect you want. And, just in case you've not seen it, you can check out this example.

I'm going to close this in favor of continuing to track this feature in #5583. Thanks for the report!

@boundsj boundsj closed this as completed Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

2 participants