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

Method getAllChildMarkers() return only 1 marker when cluster contains 2 child #1070

Open
kadekval opened this issue Aug 12, 2022 · 0 comments

Comments

@kadekval
Copy link

kadekval commented Aug 12, 2022

How to reproduce

  • leaflet version: 1.8.0
  • leaflet.markercluster: 1.5.3
  • react leaflet: 4.0.0
  • react: 18
  • OS: Macos Monterey
  • browser chrome: 103.0.5060.134

What behaviour I'm expecting and which behaviour I'm seeing

i am creating a cluster with its icon using pie chart, but i found some trouble when the cluster has 2 child, getAllChildMarkers() return only 1 marker when cluster contains 2 child

Screen Shot 2022-08-12 at 15 27 40

Screen Shot 2022-08-12 at 15 26 25

red line is the cluster has 2 child
green line is the cluster has more than 2 child

Related Codes

I think the problem comes from here

//If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
if (m.__parent) {
if (m.__parent.getChildCount() === 2) {
var markers = m.__parent.getAllChildMarkers(),
otherMarker = markers[0] === m ? markers[1] : markers[0];
fg.removeLayer(otherMarker);
}

why should there be a code to remove the marker?

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

No branches or pull requests

1 participant