-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent pitch and zoom from exceeding limits #103
Conversation
@@ -165,7 +165,7 @@ public class CameraManager { | |||
- Parameter completion: The completion block to execute after the transition has occurred. | |||
*/ | |||
|
|||
public func setCamera(to newCamera: CameraOptions, | |||
public func setCamera(to camera: CameraOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@julianrex we spoke about cleaning up these methods. But with this change to only having this single setCamera method. It removes the ability to opt out of optimizing bearing. We should probably add that logic here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on discussion with @julianrex we'll move forward with this change and revisit adding an option to opt-out of bearing optimization.
443bba0
to
d50e767
Compare
anchor: camera.anchor, | ||
zoom: camera.zoom?.clamped(to: mapCameraOptions.minimumZoomLevel...mapCameraOptions.maximumZoomLevel), | ||
bearing: optimizeBearing(startBearing: mapView.bearing, endBearing: camera.bearing), | ||
pitch: camera.pitch?.clamped(to: mapCameraOptions.minimumPitch...mapCameraOptions.maximumPitch)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also increase the default maximumPitch
value in MapCameraOptions
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. What should I change it to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to 85. cc: @mapbox/maps-android
@@ -0,0 +1,11 @@ | |||
internal extension Comparable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice!
d50e767
to
de71fa1
Compare
Codecov Report
@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 48.81% 48.88% +0.07%
==========================================
Files 100 101 +1
Lines 5607 5605 -2
==========================================
+ Hits 2737 2740 +3
+ Misses 2870 2865 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Pull request checklist:
mapbox-maps-ios
changelog:<changelog>Prevent pitch and zoom from exceeding limits. Also updates default maximum pitch to 85 degrees.</changelog>
.Summary of changes
setCamera(centerCoordinate:padding:anchor:zoom:bearing:pitch:animated:duration:completion:)
intosetCamera(to:animated:duration:completion:)
MapCameraOptions
Comparable
that uses a ClosedRange parametertestSetCamera()
which had several assertions that checked for "changes" that were identical to the initial values.User impact (optional)
When continuing to use the pitch gesture after reaching the maximum or minimum pitch, the map will no longer require you to "undo" those superfluous gestures to reverse the pitch.