Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation click doesn't consume map click #966

Closed
mar-v-in opened this issue May 23, 2019 · 7 comments · Fixed by #1124
Closed

Annotation click doesn't consume map click #966

mar-v-in opened this issue May 23, 2019 · 7 comments · Fixed by #1124
Assignees

Comments

@mar-v-in
Copy link

Currently when clicking an annotation, this will trigger the annotation click event without consuming the map click event. I would assume the annotation manager to consume the map click event if it already invoked an annotation click listener, so that the map click event isn't invoked for any map element that is below the annotation (as most likely, the user didn't click anything below the annotation, but really the annotation itself).

@LukasPaczos
Copy link
Contributor

Hey @mar-v-in, we can't consume events in the plugin, otherwise, there'd be no way to register other listeners after the plugin has been initialized. See #815.

@mar-v-in
Copy link
Author

@LukasPaczos My proposal would be to only consume the event if a marker click listener was invoked, which means the click happened on a marker and a marker click listener is registered. In all other cases the event would not be consumed so other listeners can use it. The rationale behind this is that the user doesn't actually click the map, but the annotation. I think this is also the same behavior other Maps APIs chose.

I am currently porting an app from Google Maps API to Mapbox SDK and noted this slight difference in behavior, which in my case caused the app to become unusable as a marker click was used to activate the marker and a map click to deactivate the current marker. As both happen on Mapbox SDK, the markers became not activatable (as they are activated and deactivated at the very same time). My current workaround is to ignore map click event for deactivation if it happens at the location of any marker.

@LukasPaczos
Copy link
Contributor

Thanks @mar-v-in, I think the proposed behavior is rational. Additionally, we could make AnnotationClickListeners return booleans as well and consume the upstream click callback only if one of the downstream listeners consumes it.

@mar-v-in
Copy link
Author

mar-v-in commented May 24, 2019

Additionally, we could make AnnotationClickListeners return booleans as well and consume the upstream click callback only if one of the downstream listeners consumes it.

Agree, this is probably the best thing to do here, but it would create an API incompatibility, so is only an option for a major version bump.

@LukasPaczos
Copy link
Contributor

Plugins are designed for quick iterations and are all on the 0.x versions, which doesn't rule out breaking changes in the APIs by the semantic versioning rule book.

@stale
Copy link

stale bot commented Mar 21, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

@stale stale bot added the archived Archived by Stale bot. label Mar 21, 2020
@stale
Copy link

stale bot commented Mar 21, 2020

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

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

Successfully merging a pull request may close this issue.

3 participants