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

Programatically setting the pitch to 0 via the camera also moves the map #2375

Closed
maciekish opened this issue Sep 21, 2015 · 2 comments
Closed
Labels
bug iOS Mapbox Maps SDK for iOS

Comments

@maciekish
Copy link
Contributor

If i run the following code in your test app (via make iproj) and the pitch isn't already 0, it will jump to some arbitrary coordinate.

[self.mapView setCamera:[MGLMapCamera cameraLookingAtCenterCoordinate:self.mapView.centerCoordinate fromDistance:self.mapView.camera.altitude pitch:0 heading:0] animated:NO];

As you can see I'm reusing the current centerCoordinate and altitude. All i want is to set the pitch to 0. Am i doing it wrong or is this a bug?

If you just expose the mbgl::Map->setPitch function it works perfectly fine.

- (void)setPitch:(double)pitch
{
    _mbglMap->setPitch(pitch);
}

cc @Zakay

@maciekish maciekish changed the title Programatically setting the pitch to 0 also moves the map Programatically setting the pitch to 0 via the camera also moves the map Sep 21, 2015
@incanus incanus added bug iOS Mapbox Maps SDK for iOS labels Sep 21, 2015
@1ec5
Copy link
Contributor

1ec5 commented Sep 22, 2015

Can you provide a coordinate pair and pitch to test with? I do see that the map effectively zooms out when starting out tilted, due to #2139 and the use of “fit bounds” when applying a camera, but the center coordinate stays fixed.

@maciekish
Copy link
Contributor Author

It appears like this was caused by my new userConstrain function. I updated my PR with a bugfix #2341. I was incorrectly assuming that Cc and Bc in TransformState always correspond to the current zoom level, but it appears like they sometimes change before constrain and userConstrain are called which produced incorrect x_ and y_.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

3 participants