diff options
-rw-r--r-- | docs/BUILD_OSX.md | 2 | ||||
-rw-r--r-- | platform/osx/src/MGLMapView.mm | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/docs/BUILD_OSX.md b/docs/BUILD_OSX.md index 0d3c685f41..87793c48da 100644 --- a/docs/BUILD_OSX.md +++ b/docs/BUILD_OSX.md @@ -4,7 +4,7 @@ This project provides an OS X SDK analogous to the Mapbox iOS SDK. Mapbox does n ### Build -1. Run `make xpackage`, which produces a `Mapbox.framework` in the `gyp/build/Release/` folder. +1. Run `make xpackage`, which produces a `Mapbox.framework` in the `build/osx/pkg/` folder. ### Install diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 5d3995b3eb..0ccf93ba83 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -1659,14 +1659,16 @@ public: std::sort(nearbyAnnotations.begin(), nearbyAnnotations.end()); if (nearbyAnnotations == _annotationsNearbyLastClick) { + // The first selection in the cycle should be the one nearest to the + // click. CLLocationCoordinate2D currentCoordinate = [self convertPoint:point toCoordinateFromView:self]; std::sort(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag tagA, const MGLAnnotationTag tagB) { CLLocationCoordinate2D coordinateA = [[self annotationWithTag:tagA] coordinate]; CLLocationCoordinate2D coordinateB = [[self annotationWithTag:tagB] coordinate]; - double distanceA = hypot(coordinateA.latitude - currentCoordinate.latitude, - coordinateA.longitude - currentCoordinate.longitude); - double distanceB = hypot(coordinateB.latitude - currentCoordinate.latitude, - coordinateB.longitude - currentCoordinate.longitude); + CLLocationDegrees distanceA = hypot(coordinateA.latitude - currentCoordinate.latitude, + coordinateA.longitude - currentCoordinate.longitude); + CLLocationDegrees distanceB = hypot(coordinateB.latitude - currentCoordinate.latitude, + coordinateB.longitude - currentCoordinate.longitude); return distanceA < distanceB; }); |