[ios] Fix user location horizontal accuracy ring inaccuracy
Accuracy was off by +25%, depending on latitude.
This commit is contained in:
@@ -6,6 +6,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
|
||||
|
||||
* Added an MGLStyle.localizesLabels property, off by default, that localizes any Mapbox Streets–sourced symbol layer into the user’s preferred language. ([#9582](https://github.com/mapbox/mapbox-gl-native/pull/9582))
|
||||
* Added an additional camera method to MGLMapView that accepts an edge padding parameter. ([#9651](https://github.com/mapbox/mapbox-gl-native/pull/9651))
|
||||
* Fixed an issue with the scaling of the user location annotation’s horizontal accuracy indicator. ([#9721](https://github.com/mapbox/mapbox-gl-native/pull/9721))
|
||||
|
||||
## 3.6.1 - July 28, 2017
|
||||
|
||||
|
||||
@@ -460,11 +460,8 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
|
||||
|
||||
- (CGFloat)calculateAccuracyRingSize
|
||||
{
|
||||
CGFloat latitudeRadians = MGLRadiansFromDegrees(self.userLocation.coordinate.latitude);
|
||||
CGFloat metersPerPoint = [self.mapView metersPerPointAtLatitude:self.userLocation.coordinate.latitude];
|
||||
CGFloat pixelRadius = self.userLocation.location.horizontalAccuracy / cos(latitudeRadians) / metersPerPoint;
|
||||
|
||||
return pixelRadius * 2.0;
|
||||
// diameter in screen points
|
||||
return self.userLocation.location.horizontalAccuracy / [self.mapView metersPerPointAtLatitude:self.userLocation.coordinate.latitude] * 2.0;
|
||||
}
|
||||
|
||||
- (UIImage *)headingIndicatorTintedGradientImage
|
||||
|
||||
Reference in New Issue
Block a user