diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-08-12 15:45:18 -0700 |
---|---|---|
committer | Jesse Bounds <jesse@rebounds.net> | 2016-08-12 15:45:18 -0700 |
commit | e147887e357f537a5c625fd3edda7b13d64142b3 (patch) | |
tree | b1dbb6be088d91bb785ec599a4f62112ae6a05ea /platform/macos | |
parent | 272ec0c30ba1b68db3b2b9ea76659ae0a489189f (diff) | |
download | qtlocation-mapboxgl-e147887e357f537a5c625fd3edda7b13d64142b3.tar.gz |
[core, android, ios, macos] Replaced getPointAnnotationsInBounds() w/ queryPointAnnotations() (#5165)
queryPointAnnotations() accepts a screen rectangle instead of a geographic bounding box, so marker hit testing works at the edges of a rotated, tilted map view.
Fixes #5151.
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index c9f295d7e7..de127a7481 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -1897,8 +1897,11 @@ public: /// Returns the tags of the annotations coincident with the given rectangle. - (std::vector<MGLAnnotationTag>)annotationTagsInRect:(NSRect)rect { - mbgl::LatLngBounds queryBounds = [self convertRect:rect toLatLngBoundsFromView:self]; - return _mbglMap->getPointAnnotationsInBounds(queryBounds); + // Cocoa origin is at the lower-left corner. + return _mbglMap->queryPointAnnotations({ + { NSMinX(rect), NSHeight(self.bounds) - NSMaxY(rect) }, + { NSMaxX(rect), NSHeight(self.bounds) - NSMinY(rect) }, + }); } - (id <MGLAnnotation>)selectedAnnotation { |