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

Marker disappears from parent layer after setting marker new coordinates #1091

Open
rsnow67 opened this issue Jun 1, 2023 · 0 comments
Open

Comments

@rsnow67
Copy link

rsnow67 commented Jun 1, 2023

  • [+] I'm reporting a bug, not asking for help
  • [+] I'm sure this is a Leaflet.MarkerCluster code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • [+] I've searched through the issues to make sure it's not yet reported

How to reproduce

  • Leaflet version I'm using: 1.9.4
  • Leaflet.MarkerCluster version I'm using: 1.5.3
  • Browser (with version) I'm using: Chrome 113.0.5672.126
  • OS/Platform (with version) I'm using: macOS Ventura 13.4

Steps:

  1. Initialize map
  2. Сreate new markerClusterGroup
  3. Add markerClusterGroup to map by addTo()
  4. Create new marker
  5. Add this marker to markerClusterGroup by addLayer()
  6. Try to get marker by getLayer() from markerClusterGroup – you'll get it
  7. Remove markerClusterGroup from map by removeLayer()
  8. Set marker new coordinates by setLatLng()
  9. Try to get marker by getLayer() from markerClusterGroup – you'll get null
  10. Re-add markerClusterGroup to map
  11. Try to get marker by getLayer() from markerClusterGroup – you'll get it
    (all code below)

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

I expect that after setting marker new coordinates I can get marker by getLayer() method before I re-add parent layer to map, but I get null.

Minimal example reproducing the issue

  • [+] this example is as simple as possible
  • [+] this example does not rely on any third party code

https://plnkr.co/edit/UUuWoMVgk85eyHQk

@rsnow67 rsnow67 changed the title The marker disappears from the parent layer after removing this layer and setting new coordinates The marker disappears from the parent layer after setting new coordinates Jun 1, 2023
@rsnow67 rsnow67 changed the title The marker disappears from the parent layer after setting new coordinates Marker disappears from parent layer after setting marker new coordinates Jun 1, 2023
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