Last active
March 19, 2018 08:11
-
-
Save lloydsheng/0d9b1cc76eb08bdf45810668c1eb1502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (MKMapRect)visibleMapRect { | |
MGLCoordinateBounds bounds = self.mapboxMapView.visibleCoordinateBounds; | |
MKMapPoint sw = MKMapPointForCoordinate(bounds.sw); | |
MKMapPoint ne = MKMapPointForCoordinate(bounds.ne); | |
double x = sw.x; | |
double y = ne.y; | |
double width = ne.x - sw.x; | |
double height = sw.y - ne.y; | |
if (width < 0) { | |
width += MKMapSizeWorld.width; | |
} | |
if (height < 0) { | |
height += MKMapSizeWorld.height; | |
} | |
return MKMapRectMake(x, y, width, height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment