mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
286 stars 117 forks source link

How can I get the position of the clicked polylineAnnotation #699

Open lantah-1 opened 1 month ago

lantah-1 commented 1 month ago

final manager = await mapboxMap.annotations.createPolylineAnnotationManager(); manager.addOnPolylineAnnotationClickListener(_LineAnnotationClickListener((an) { // How can i get the position of clicked event }));

@evil159 can you help me ? thanks very much.

evil159 commented 1 month ago

@lantah-1 I don't think you can get that from this listener

lantah-1 commented 1 month ago

@lantah-1 I don't think you can get that from this listener

My app needs to know which point on the route was clicked. How can I get it?

evil159 commented 1 month ago

I think currently the only way to do that is to add your own click listener that will give you screen coordinates and then pass them to the 'queryRenderedFeatures' method.

evil159 commented 1 month ago

We plan to pass touch coordinates along with the annotation though.

lantah-1 commented 1 month ago

I think currently the only way to do that is to add your own click listener that will give you screen coordinates and then pass them to the 'queryRenderedFeatures' method.

CleanShot 2024-09-20 at 18 13 00@2x This callback returns true, which causes the map's onMapClick method to not be called back.

lantah-1 commented 1 month ago

We plan to pass touch coordinates along with the annotation though.

Looking forward to it !!!