mapbox / mapbox/mapbox-maps-flutter

Only First annotation is being returned from Annotation tap detection

Open
#376 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

@evil159

```
extension AnnotationController: AnnotationInteractionDelegate {
func annotationManager(_ manager: AnnotationManager, didDetectTappedAnnotations annotations: [Annotation]) {
let annotation = annotations.first
switch annotation {
case let annotation as PointAnnotation:
self.onPointAnnotationClickListener?.onPointAnnotationClick(annotation.toFLTPointAnnotation(), completion: {_ in })
case let annotation as CircleAnnotation:
self.onCircleAnnotationClickListener?.onCircleAnnotationClick(annotation.toFLTCircleAnnotation(), completion: {_ in })
case let annotation as PolygonAnnotation:
self.onPolygonAnnotationClickListener?.onPolygonAnnotationClick(annotation.toFLTPolygonAnnotation(), completion: {_ in })
case let annotation as PolylineAnnotation:
self.onPolylineAnnotationClickListener?.onPolylineAnnotationClick(annotation.toFLTPolylineAnnotation(), completion: {_ in })
default:
print("Can't detemine the type of annotation: \(annotation)")
}
}
}
```

On native side the code is returning only first annotation from list of annotations which were detected on Tap `didDetectTappedAnnotations`

Few clarifications and concerns:

1- Why not return all annotations ?
2- What is tap detect accuracy ? is based on point on Screen Box ?
3- when returning the first annotation from list of annotations, is the list already sorted by annotation sort key ? If Yes, is it ASC or DESC ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AnnotationController annotationManager(_:didDetectTappedAnnotations:) delegate shown in the issue and trace how the native tap result reaches Flutter. Determine whether all detected annotations and their ordering are exposed, along with the tap-detection accuracy, then add or update coverage and documentation so the returned behavior is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.