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

[iOS] Map view can now be optionally configured to make pitch adjustments without affecting altitude - #12938

Closed
d-prukop wants to merge 1 commit into
masterfrom
pitch-without-altitude-change
Closed

d-prukop wants to merge 1 commit into
masterfrom
pitch-without-altitude-change

Conversation

@d-prukop

Copy link
Copy Markdown
Contributor

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
before | after

@d-prukop d-prukop added feature iOS Mapbox Maps SDK for iOS labels Sep 21, 2018
@d-prukop d-prukop changed the title Map view can now be optionally configured to make pitch adjustments without affecting altitude [iOS] Map view can now be optionally configured to make pitch adjustments without affecting altitude Sep 21, 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.

I'm going to link the previous PR for reference purposes #12518

@julianrex

Copy link
Copy Markdown
Contributor

@d-prukop Does this updated PR address @1ec5's concerns in #12518 (comment)?

@d-prukop

Copy link
Copy Markdown
Contributor Author

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

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.

#12966 proposes an alternative to this property that avoids implicitly reinterpreting existing properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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

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.

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];

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.

Same here.

@1ec5

1ec5 commented Oct 9, 2018

Copy link
Copy Markdown
Contributor

Closing in favor of #12966 and #12986 per discussion with @d-prukop.

@1ec5 1ec5 closed this Oct 9, 2018
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants