You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving a marker inside a MarkerCluster.LayerSupport layer with marker.setLatLng() produces an error:
error TypeError: Cannot read property 'x' of undefined
at L.DistanceGrid._sqDist (https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js:1917:20)
at L.DistanceGrid.getNearObject (https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js:1899:20)
at NewClass._addLayer (https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js:984:36)
at NewClass.<anonymous> (https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js:253:11)
at NewClass.addLayers (https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js:287:4)
at NewClass.addLayers (https://unpkg.com/[email protected]/dist/leaflet.markercluster.layersupport-src.js:115:8)
at NewClass._processSingleAddRemoveBuffer (https://unpkg.com/[email protected]/dist/leaflet.markercluster.layersupport-src.js:267:29)
The problem is that LayerSupport buffers the add/remove operations and MarkerCluster implements moving a marker via removing and readding the marker. MarkerCluster expects the remove/add calls to be synchronous:
Hum I see the issue…
I cannot think of an easy solution to make _moveChild compatible with singleAddRemoveBufferDuration right now.
As you say, the easy workaround is to set singleAddRemoveBufferDuration option to 0.
Maybe it could be even better to have 0 as the default value?
Or at least mention it in the README?
Hm, I think making 0 the default value would be good then. It's better to work correctly by default than optimize for performance. The singleAddRemoveBufferDuration option should be documented to have issues with moving markers.
Moving a marker inside a
MarkerCluster.LayerSupport
layer withmarker.setLatLng()
produces an error:See: https://playground-leaflet.rhcloud.com/cave/edit?html,output
The problem is that LayerSupport buffers the add/remove operations and MarkerCluster implements moving a marker via removing and readding the marker. MarkerCluster expects the remove/add calls to be synchronous:
The issue can be worked around by disabling buffering in LayerSupport (by setting singleAddRemoveBufferDuration: 0).
See: https://playground-leaflet.rhcloud.com/yayab/edit?html,output
I'm not sure if this issue can be fixed in LayerSupport, or needs an improved move behaviour in MarkerCluster.
The text was updated successfully, but these errors were encountered: