Leaflet.markercluster icon indicating copy to clipboard operation
Leaflet.markercluster copied to clipboard

Dragged marker gets clustered when dragging&zooming above a cluster

Open jessenic opened this issue 6 years ago • 7 comments

How to reproduce

  • Leaflet version I'm using: 1.1.0
  • Leaflet.MarkerCluster version I'm using: 1.0.6
  • Browser (with version) I'm using: Chrome 59 + Edge 40
  • OS/Platform (with version) I'm using: Windows 10 Creators Update
  • Open a map with clustered draggable markers
  • Start dragging a marker above a cluster, zoom in. The cluster will eat the marker and map gets stuck.

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

I'm expecting markers to be able to dragged and map to be zoomed. Dragged markers should not get clustered. But what seems to be happening is that the cluster will eat the marker if the marker is being dragged above it while zooming.

Minimal example reproducing the issue

For example this is taken from #685: https://jsfiddle.net/3v7hd2vx/245/ In this one the map doesn't get stuck, but the cluster is eating the marker which I believe causes the map getting stuck for me. (My map also got stuck if I removed a marker while it was being dragged)

After updating the fiddle to Leaflet 1.1.0, the map gets stuck like mine: https://jsfiddle.net/3v7hd2vx/343/

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

jessenic avatar Jul 17 '17 13:07 jessenic

Also reported to Leaflet: https://github.com/Leaflet/Leaflet/issues/5638

Map getting stuck seems to be issue of theirs, but still a dragged marker should not get grouped while zooming in.

jessenic avatar Jul 17 '17 14:07 jessenic

hahaha, nice find. Hopefully when the lockup is fixed in leaflet it should fix it here?

danzel avatar Jul 18 '17 04:07 danzel

Haha yeah, the lockup is a Leaflet issue that seems to have been introduced in 1.1.0. But the issue here is that a marker that is being dragged will get clustered if you are dragging it above a cluster and zoom in/out.

For example: Zoom fully in, start dragging a marker, then using the mouse wheel zoom out (and in again) while keeping the marker above a cluster: https://jsfiddle.net/3v7hd2vx/245/

In my application there are hundreds to thousands of markers on the map, user should be able to zoom in, pick a marker, then zoom out and move it somewhere else on the map. Would be also nice to be able to prevent that dragged marker getting clustered even after the drag until the user has confirmed the new location.

jessenic avatar Jul 18 '17 10:07 jessenic

Perhaps my PR #909 will also solve this problem, @jessenic can you test at https://jsfiddle.net/thy3c540/1/ ?

DerGuteWolf avatar Aug 06 '18 08:08 DerGuteWolf

This is improved now, but if the marker would get clustered at the zoom level you zoom out to it still gets merged (I think)

danzel avatar Sep 13 '18 22:09 danzel

Zooming out while dragging worked in my tests, but there is a problem when zooming in again. I will try to find out what goes wrong then and will try to provide a fix for this also, but it will take some time.

DerGuteWolf avatar Sep 14 '18 05:09 DerGuteWolf

Cool :)

On Fri, 14 Sep 2018 at 5:54 PM, DerGuteWolf [email protected] wrote:

Zooming out while dragging worked in my tests, but there is a problem when zooming in again. I will try to find out what goes wrong then and will try to provide a fix for this also, but it will take some time.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Leaflet/Leaflet.markercluster/issues/808#issuecomment-421239262, or mute the thread https://github.com/notifications/unsubscribe-auth/AAX_fsFnO8FIPjKJi9CioNYdLb1nnj9Tks5ua0SOgaJpZM4OaAIG .

danzel avatar Sep 14 '18 06:09 danzel