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

How to disable interaction MGLPolygon? - iOS #11234

Closed
eastern-amol opened this issue Feb 18, 2018 · 4 comments
Closed

How to disable interaction MGLPolygon? - iOS #11234

eastern-amol opened this issue Feb 18, 2018 · 4 comments
Labels
iOS Mapbox Maps SDK for iOS support

Comments

@eastern-amol
Copy link

Hi Guys,

I'm using mapbox in my project, I'm facing one issue like Polygon area is getting touch/click, I want disable it.

Would you please someone guide me how I can do this? I search lot but didn't get any solution on it.

MGLPolygon overlay should not be clickable in my requirement, because its creating problem for markers/MGLAnnotation to detect click.

@LukasPaczos LukasPaczos added the iOS Mapbox Maps SDK for iOS label Feb 19, 2018
@jmkiley
Copy link
Contributor

jmkiley commented Feb 19, 2018

One option is to implement a check for the type of annotation that was selected. For example:

    func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {
        if annotation.isKind(of: MGLPolygon.self) {
            return
        }
        
        print("Point selected")
    }
    ```

@jmkiley jmkiley closed this as completed Feb 19, 2018
@eastern-amol
Copy link
Author

eastern-amol commented Mar 25, 2018

Hi jmkiley,

If I add above suggested validation then we need click on marker 2 times, because first click its taking for polygon which we added and on second click its taking for marker. which not good as per user point of view.

Please suggest, if any other workaround for this?

@hernangonzalez
Copy link

I am experiencing a similar issue. MGLPolygon is consuming touches, and preventing other handlers from handling them. i.e. To handle feature touch on a cluster.
Should this be reopened @jmkiley ? Thank you, H.

@jmkiley
Copy link
Contributor

jmkiley commented Jun 26, 2018

Thanks for following up! This issue is being tracked in #10539

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS support
Projects
None yet
Development

No branches or pull requests

5 participants