You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Annotations are not selected when map is rotated #15082
If you add an Annotation (MGLPointAnnotation) then when the map is rotated the Annotation is not selected (in fact not found by the "- (MGLAnnotationTag)annotationTagAtPoint:(CGPoint)point persistingResults:(BOOL)persist").
Steps to reproduce
Using the demo App
Make a long press gesture and add a pin
Tap on the pin with map not rotated, it is detected and selected ("- (BOOL)mapView:(__unused MGLMapView *)mapView annotationCanShowCallout:(__unused id )annotation" is called)
rotate the map (90# is fine but seems not so important)
tap on the pin and the pin it is NOT detected
Expected behavior
I expect that the same Annotation is found in "any map conditions": rotated, tilted.
Actual behavior
The MGLPointAnnotations are not detected when the map is rotated
Hi,
maybe I was not able to preperly explain the issue but I think there is a misunderstanding.
The problem is the detection of the MGLAnnotation when you tap (and not the callout).
What I mean is that the
(MGLAnnotationTag)annotationTagAtPoint:(CGPoint)point persistingResults:(BOOL)persist
function in the MGLMapView, when calling the
std::vector nearbyAnnotations = [self annotationTagsInRect:queryRect];
does not find any annotation under the tap if the map is rotated, whereas the same function, with the same data found the annotation if the map it is not rotated (rotated using the 2 finger rotation gesture).
Moreover, I was having other problems with the Annotation and I'm debugging a little bit the code and I found something that I'm not sure it is related with above issue: if you zoom (with pinch) at zoom levels that are not perfectly aligned (not an integer value) annotations are also not found.
What I have seen is that in the
std::pair<bool,bool> CollisionIndex::placeFeature(CollisionFeature& feature, ...
function, the calculated projected point
const auto projectedPoint = projectAndGetPerspectiveRatio(posMatrix, box.anchor);
is wrong (sensibly wrong) when you are in this "in between zoom",
Maybe there is something I'm doing wrong (highly probable because I'm not expert in Mapbox) but I worked in the past with RouteMe and Mapnik and other libraries like these and I cannot understand what I'm doing wrong.
Activity
julianrex commentedon Jul 9, 2019
Thanks for your feedback @cbo1964.
Our documentation here is misleading and currently slightly inaccurate: See
MGLCalloutView.dismissesAutomatically- it statesThis should read whether the annotation is automatically deselected (and in the process dismisses the callout).
Please try implementing
dismissesAutomaticallyso that it returnsNOto see if that solves your issue. Also...Leaving this issue open as a documentation task and potential feature improvement.
cbo1964 commentedon Jul 9, 2019
Hi,
maybe I was not able to preperly explain the issue but I think there is a misunderstanding.
The problem is the detection of the MGLAnnotation when you tap (and not the callout).
What I mean is that the
function in the MGLMapView, when calling the
std::vector nearbyAnnotations = [self annotationTagsInRect:queryRect];
does not find any annotation under the tap if the map is rotated, whereas the same function, with the same data found the annotation if the map it is not rotated (rotated using the 2 finger rotation gesture).
Moreover, I was having other problems with the Annotation and I'm debugging a little bit the code and I found something that I'm not sure it is related with above issue: if you zoom (with pinch) at zoom levels that are not perfectly aligned (not an integer value) annotations are also not found.
What I have seen is that in the
std::pair<bool,bool> CollisionIndex::placeFeature(CollisionFeature& feature, ...
function, the calculated projected point
const auto projectedPoint = projectAndGetPerspectiveRatio(posMatrix, box.anchor);
is wrong (sensibly wrong) when you are in this "in between zoom",
Maybe there is something I'm doing wrong (highly probable because I'm not expert in Mapbox) but I worked in the past with RouteMe and Mapnik and other libraries like these and I cannot understand what I'm doing wrong.
Thanks
julianrex commentedon Jul 9, 2019
Thanks for the clarification @cbo1964!
cbo1964 commentedon Jul 10, 2019
I think this problem is the same than #14977
julianrex commentedon Jul 12, 2019
PR for this issue: #15097
[ios][macos] Fix center coordinate incorrect after pinch gesture
[ios][macos] Fix center coordinate incorrect after pinch gesture
[ios][macos] Fix center coordinate incorrect after pinch gesture
[ios][macos] Fix center coordinate incorrect after pinch gesture