Repository navigation
[iOS] Map view can now be optionally configured to make pitch adjustments without affecting altitude - #12938
[iOS] Map view can now be optionally configured to make pitch adjustments without affecting altitude#12938d-prukop wants to merge 1 commit into
Conversation
…ithout affecting altitude
fabian-guerra
left a comment
There was a problem hiding this comment.
I'm going to link the previous PR for reference purposes #12518
|
@d-prukop Does this updated PR address @1ec5's concerns in #12518 (comment)? |
|
@julianrex yes... kind of. I think it leaves us in the situation mentioned in the last sentence of that post. It's not ideal but it should be acceptable until we can rework the camera. |
| @property (nonatomic) CFTimeInterval frameTime; | ||
| @property (nonatomic) CFTimeInterval averageFrameTime; | ||
|
|
||
| @property (nonatomic, getter=isCameraAltitudeAffectedByPitch) BOOL cameraAltitudeAffectedByPitch; |
There was a problem hiding this comment.
#12966 proposes an alternative to this property that avoids implicitly reinterpreting existing properties.
There was a problem hiding this comment.
@d-prukop in reference to the above #12966 (comment), assuming that lands first will this PR require a change?
| CLLocationDistance distance = MGLAltitudeForZoomLevel(*camera.zoom, pitch, 0, self.frame.size); | ||
| CGFloat pitchForAltitude = self.isCameraAltitudeAffectedByPitch ? pitch : 0.0; | ||
| CLLocationDistance distance = MGLAltitudeForZoomLevel(*camera.zoom, pitchForAltitude, 0, self.frame.size); | ||
| self.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:MGLLocationCoordinate2DFromLatLng(*camera.center) |
There was a problem hiding this comment.
Regardless of whether #12966 lands, we should probably change this to use
-[MGLMapCamera cameraLookingAtCenterCoordinate:altitude:pitch:heading:] and rename the distance variable as altitude. Is my understanding correct?
| CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitch, centerCoordinate.latitude, self.frame.size); | ||
| CGFloat pitchForAltitude = self.isCameraAltitudeAffectedByPitch ? pitch : 0.0; | ||
| CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitchForAltitude, centerCoordinate.latitude, self.frame.size); | ||
| return [MGLMapCamera cameraLookingAtCenterCoordinate:centerCoordinate fromDistance:altitude pitch:pitch heading:direction]; |
Moved from #12518
Map view can now be optionally configured to make pitch adjustments without affecting altitude.
This addresses part of #9808
Pitch changes using MGLAltitudeForZoomLevel and MGLZoomLevelForAltitude from the MGLGeometry library were animating in a strange fashion when using the new proposed camera animation system (located here: https://github.com/mapbox/mapbox-ios-map-camera).
I added a flag to turn off this association between pitch and altitude.
This property is not exposed in the header.
Before | After
| 