mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: catch cluster error at zoom in certain situation (#2464)
Eg. to reproduce: a map with a limitBounds that makes uMap immediately zoom to fit the bbox.
This commit is contained in:
commit
48f4daf419
1 changed files with 11 additions and 1 deletions
|
@ -63,7 +63,17 @@ export const Cluster = L.MarkerClusterGroup.extend({
|
|||
|
||||
addLayer: function (layer) {
|
||||
this._layers.push(layer)
|
||||
try {
|
||||
return L.MarkerClusterGroup.prototype.addLayer.call(this, layer)
|
||||
} catch (error) {
|
||||
console.debug(error)
|
||||
// Certainly a race condition when loading a clustered layer
|
||||
// while zooming (this for example can happen at load, when the
|
||||
// initial zoom is changed by uMap).
|
||||
// FIXME: remove when this is merged:
|
||||
// https://github.com/Leaflet/Leaflet.markercluster/pull/1048/files
|
||||
return this
|
||||
}
|
||||
},
|
||||
|
||||
removeLayer: function (layer) {
|
||||
|
|
Loading…
Reference in a new issue