diff options
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index c9d3145e2e..fdecf2b243 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2177,8 +2177,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) /// Converts a geographic bounding box to a rectangle in the view’s coordinate /// system. - (CGRect)convertLatLngBounds:(mbgl::LatLngBounds)bounds toRectToView:(nullable UIView *)view { - CGRect rect = { [self convertLatLng:bounds.sw toPointToView:view], CGSizeZero }; - rect = MGLExtendRect(rect, [self convertLatLng:bounds.ne toPointToView:view]); + CGRect rect = { [self convertLatLng:bounds.southwest() toPointToView:view], CGSizeZero }; + rect = MGLExtendRect(rect, [self convertLatLng:bounds.northeast() toPointToView:view]); return rect; } @@ -2186,7 +2186,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) /// bounding box. - (mbgl::LatLngBounds)convertRect:(CGRect)rect toLatLngBoundsFromView:(nullable UIView *)view { - mbgl::LatLngBounds bounds = mbgl::LatLngBounds::getExtendable(); + mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); bounds.extend([self convertPoint:rect.origin toLatLngFromView:view]); bounds.extend([self convertPoint:{ CGRectGetMaxX(rect), CGRectGetMinY(rect) } toLatLngFromView:view]); bounds.extend([self convertPoint:{ CGRectGetMaxX(rect), CGRectGetMaxY(rect) } toLatLngFromView:view]); @@ -2195,26 +2195,26 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) // The world is wrapping if a point just outside the bounds is also within // the rect. mbgl::LatLng outsideLatLng; - if (bounds.sw.longitude > -180) + if (bounds.west() > -180) { outsideLatLng = { - (bounds.sw.latitude + bounds.ne.latitude) / 2, - bounds.sw.longitude - 1, + (bounds.south() + bounds.north()) / 2, + bounds.west() - 1, }; } - else if (bounds.ne.longitude < 180) + else if (bounds.east() < 180) { outsideLatLng = { - (bounds.sw.latitude + bounds.ne.latitude) / 2, - bounds.ne.longitude + 1, + (bounds.south() + bounds.north()) / 2, + bounds.east() + 1, }; } // If the world is wrapping, extend the bounds to cover all longitudes. if (CGRectContainsPoint(rect, [self convertLatLng:outsideLatLng toPointToView:view])) { - bounds.sw.longitude = -180; - bounds.ne.longitude = 180; + bounds.extend(mbgl::LatLng(bounds.south(), -180)); + bounds.extend(mbgl::LatLng(bounds.south(), 180)); } return bounds; @@ -2965,7 +2965,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) { if ( ! annotations || ! annotations.count) return; - mbgl::LatLngBounds bounds = mbgl::LatLngBounds::getExtendable(); + mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); for (id <MGLAnnotation> annotation in annotations) { |