-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Cancel cluster expansion event #1101
Comments
It should be a fairly easy task to hack the @eriknikulski Maybe you want to try your hand at this? |
Thanks for the info, I will give it a try. |
@IvanSanchez one problem I am seeing is that |
@eriknikulski I see. It makes sense. But I'm seeing that an event handler on the whole
My approach at this point would be hacking on the bit of code that spawns a Leaflet.markercluster/src/MarkerClusterGroup.js Lines 803 to 813 in bd2794c
The chain of event handlers, as far as I can see, is as follows:
So you should be able to intercept the Do keep in mind that the event triggering logic of MarkerCluster is old, as in legacy from Leaflet 0.x old. It's a bit finicky and it might not cover the usual mechanisms for event stopping that we are used to nowadays. |
Thanks! I looked at it a bit more and found out if I attach the event handler before any layer is added to |
When clicking on a cluster I sometimes need to cancel the expansion event to do something else.
On the event
clusterclick
I have an event handler. Usingevent.originalEvent.stopPropagation();
andevent.originalEvent.stopImmediatePropagation()
I tried to cancel further propagation to avoid the expansion but that does not work. I also looked atspiderfied
but this does not have a propertyoriginalEvent
to access the browser event.How would I go about canceling the expansion?
How to reproduce
What behaviour I'm expecting and which behaviour I'm seeing
Expected: can cancel cluster expansion
Seeing: cluster does expand
The text was updated successfully, but these errors were encountered: