-
Notifications
You must be signed in to change notification settings - Fork 157
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
Camera Pan Fix #120
Camera Pan Fix #120
Conversation
Codecov Report
@@ Coverage Diff @@
## main #120 +/- ##
=======================================
Coverage ? 48.95%
=======================================
Files ? 101
Lines ? 5689
Branches ? 0
=======================================
Hits ? 2785
Misses ? 2904
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
|
*/ | ||
func shiftCenterCoordinate(by offset: CGPoint) -> CLLocationCoordinate2D { | ||
func shiftCenterCoordinate(by offset: CGPoint, didFling: Bool) -> CLLocationCoordinate2D { |
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.
let's rename to drift
since that's what we've been using elsewhere.
pitch == 0.0 { | ||
self.cameraManager.moveCamera(by: offset, rotation: nil, pitch: nil, zoom: nil, animated: true) | ||
} | ||
self.cameraManager.moveCamera(by: offset, rotation: nil, pitch: nil, zoom: nil, animated: true, didFling: true) |
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.
Is this always true
? The pan can end without drift too.
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, from what I saw in the existing behavior and my understanding of hydrogen, all panEnded has the potential to end with a drift and we should account for that.
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.
Hmm, really? Not sure if that's true. Would be worth a test.
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.
How would we test this?
@@ -464,13 +466,25 @@ public class CameraManager { | |||
return CLLocationCoordinate2D(latitude: 0, longitude: 0) | |||
} | |||
|
|||
var pitchFactor: CGFloat = mapView.pitch |
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.
It'd be good to get an explanation of what this math is trying to do in the comments here.
*/ | ||
func shiftCenterCoordinate(by offset: CGPoint) -> CLLocationCoordinate2D { | ||
func shiftCenterCoordinate(by offset: CGPoint, drift: Bool) -> CLLocationCoordinate2D { |
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.
This is inaccurate, isn't it? This drift
property only does something if the map is pitched it seems like.
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.
correct, so if the shift is reflecting a drift, we need to account for pitch in the code. What would be a more appropriate fix here?
Create end-to-end debuggable environment
PRs must be submitted under the terms of our Contributor License Agreement CLA.
Fixes: #59
Pull request checklist:
Summary of changes
This PR provides a stop gap solution to account for pitched maps when panning. The logic is the same that is provided in Android to account for panning flings.