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

Stop propagation of clicks on Markers #157

Merged
merged 1 commit into from
May 1, 2024

Conversation

dabreegster
Copy link
Contributor

Related to #155. If you want to be able to click an empty part of the map and distinguish that from clicking an existing Marker, then I think this is necessary. I don't know if this is reasonable default behavior, or if it should be configurable though.

Testing in an external project, https://acteng.github.io/inspectorate_tools/route_check/critical_issues_log (subject to change).
https://github.com/acteng/inspectorate_tools/blob/main/src/routes/route_check/critical_issues_log/%2Bpage.svelte
I can modify an example here to demonstrate the change, if it's helpful

Copy link

changeset-bot bot commented May 1, 2024

🦋 Changeset detected

Latest commit: fca0f88

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte-maplibre Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented May 1, 2024

@dabreegster is attempting to deploy a commit to the Daniel Imfeld's projects Team on Vercel.

A member of the Team first needs to authorize it.

@dimfeld
Copy link
Owner

dimfeld commented May 1, 2024

Yeah this makes sense. Clicking on a marker is fundamentally different from a regular map click.

I think where this could become a problem is if you set a click handler on the Map, but don't actually care about marker clicks specifically and so aren't handling them there. Unfortunately Svelte 4 doesn't let you detect if the Marker has an event listener hooked up, but this is possible with Svelte 5 style event handlers since they're just regular props.

That said, I think this change is still the right one to make since it handles the regular case better, and in the case above you can just add click handlers to your markers too.

@dimfeld dimfeld merged commit 417d468 into dimfeld:master May 1, 2024
1 check failed
@dimfeld
Copy link
Owner

dimfeld commented May 1, 2024

Published in v0.9.0

@dabreegster dabreegster deleted the stop_marker_prop branch May 6, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants