Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Howto get the front-most feature, the user tapped on #636

Open
georgbachmann opened this issue Oct 6, 2021 · 0 comments
Open

Howto get the front-most feature, the user tapped on #636

georgbachmann opened this issue Oct 6, 2021 · 0 comments

Comments

@georgbachmann
Copy link

I'd like to know if there is a way to best detect a users tap on a label?
The new iOS15 Maps app allows a tap on e.g. a cities name and then shows informations about that city.
I am now wondering if something similar can be done with mapbox?

I know that there is a mapView.visibleFeatures(in: myRect) function that can somehow help here. So I can convert my finger location to a rect and then get all features there.
BUT... my city e.g. might have a label that is let's say 200 px wide. So I would need to have a quite large rect to find the point of my city label.

Is there no way to ask the map what the frontmost element was when I tapped? So that when I tap on the far end of the label, I still get that ONE feature?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant