Skip to content

Missing option to disable onSymbolTapped event to get propagated to onMapClick event #348

Closed

Description

@n-hauschild

I have a use case where I need to detect whether the map - but not a symbol - was clicked. As the onSymbolTapped event also propagates the event to the underlying map layer, the onMapClick event is also called when a symbol is clicked. I want this behaviour:

  • when I click on the map layer, then my onMapClick callback is called
  • when I click on a custom symbol, then only my custom onSymbolTapped callback is called

Is there a way to achieve this with the existing release?

Activity

  1. m0nac0 commented on Jul 2, 2020

    @m0nac0
    Collaborator

    @nheumann Not with the current release, unfortunately, but this has been fixed upstream (mapbox/mapbox-plugins-android#1124) and when that fix is released in the Mapbox Annotation plugin, we'll update our dependency and fix this.

  2. n-hauschild commented on Jul 2, 2020

    @n-hauschild
    Author

    @m0nac0 Thank you for your quick reply. How about web and iOS?

  3. m0nac0 commented on Jul 2, 2020

    @m0nac0
    Collaborator

    @nheumann You're welcome. This bug has only been reported for Android so far, are you also experiencing this on web and iOS?

  4. n-hauschild commented on Jul 2, 2020

    @n-hauschild
    Author

    @m0nac0 I tested this in the sample app and it occurs for Android and also web. iOS works as expected.

  5. added
    bug
    on Jul 2, 2020
  6. m0nac0 commented on Jul 2, 2020

    @m0nac0
    Collaborator

    @nheumann Thanks for testing it, we'll have to look into that as well then.

  7. m0nac0 commented on Jul 2, 2020

    @m0nac0
    Collaborator

    @andrea689 Do you know how we could solve this for web? I've tried adding a stopPropagation() method to the Event, EventJsImpl, MapMouseEvent and MapMouseEventJsImpl classes in mapbox_gl_dart and calling that in mapbox_gl_web FeatureManager's click handler. That works (onMapClick is not fired anymore) but I'm also getting a TypeError: this.jsObject.stopPropagation is not a function in the debug console every time I click a symbol.

  8. GULERTOLGA commented on Jul 2, 2020

    @GULERTOLGA
    Contributor

    I went around this problem like this. Clicking on the symbol first fires onSymbolTapped and then onMapClick. After clicking the symbol, I immediately set a variable whose default is false to true. I set it to false after 100 milliseconds. I would ignore onMapClick if this value is true.

  9. Ph0tonic commented on Aug 14, 2020

    @Ph0tonic

    @nheumann Not with the current release, unfortunately, but this has been fixed upstream (mapbox/mapbox-plugins-android#1124) and when that fix is released in the Mapbox Annotation plugin, we'll update our dependency and fix this.

    The fix has been released upstream 👍

  10. m0nac0 commented on Aug 14, 2020

    @m0nac0
    Collaborator

    @Ph0tonic Thank you for fixing it! I actually (and coincidentally 😄 ) just now finished testing and opened the PR .

  11. fotiDim commented on Sep 17, 2020

    @fotiDim

    The issue is resolved on Android but still appears on web.

  12. stale commented on Jan 14, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstaleweb

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions