-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Annotations are not selected when map is rotated #15082
Comments
Thanks for your feedback @cbo1964. Our documentation here is misleading and currently slightly inaccurate: See
This should read whether the annotation is automatically deselected (and in the process dismisses the callout). Please try implementing
Leaving this issue open as a documentation task and potential feature improvement. |
Hi, The problem is the detection of the MGLAnnotation when you tap (and not the callout).
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. function, the calculated projected point 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 |
Thanks for the clarification @cbo1964! |
I think this problem is the same than #14977 |
To changelog: Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664). While working on #14664, missed to understand the logic used in ``` CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; self.mbglMap.jumpTo(mbgl::CameraOptions() .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) .withPadding(padding)); ``` Replacing this code by moveBy achieves the required translation. Fixes: #14977, #15082
PR for this issue: #15097 |
To changelog: Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664). While working on #14664, missed to understand the logic used in ``` CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; self.mbglMap.jumpTo(mbgl::CameraOptions() .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) .withPadding(padding)); ``` Replacing this code by moveBy achieves the required translation. Fixes: #14977, #15082
To changelog: Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664). While working on #14664, missed to understand the logic used in ``` CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; self.mbglMap.jumpTo(mbgl::CameraOptions() .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) .withPadding(padding)); ``` Replacing this code by moveBy achieves the required translation. Fixes: #14977, #15082
To changelog: Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664). While working on #14664, missed to understand the logic used in ``` CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; self.mbglMap.jumpTo(mbgl::CameraOptions() .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) .withPadding(padding)); ``` Replacing this code by moveBy achieves the required translation. Fixes: #14977, #15082
To changelog: Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664). While working on #14664, missed to understand the logic used in ``` CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate; mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x }; self.mbglMap.jumpTo(mbgl::CameraOptions() .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate)) .withPadding(padding)); ``` Replacing this code by moveBy achieves the required translation. Fixes: #14977, #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
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
Configuration
Mapbox SDK versions: 5.1.0
iOS/macOS versions: iOS 12.3.1
Device/simulator models: iPad Pro
Xcode version: 10.2.1
The text was updated successfully, but these errors were encountered: