mirror of
https://github.com/Leaflet/Leaflet.markercluster.git
synced 2025-08-16 15:04:51 +00:00
fix(zoomAnim): check on map with hasLayer
instead of _icon, so that it becomes compatible with non-icon-based Markers and Cluster Markers.
This commit is contained in:
@ -541,16 +541,20 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
//Zoom down to show the given layer (spiderfying if necessary) then calls the callback
|
||||
zoomToShowLayer: function (layer, callback) {
|
||||
|
||||
var map = this._map;
|
||||
|
||||
if (typeof callback !== 'function') {
|
||||
callback = function () {};
|
||||
}
|
||||
|
||||
var showMarker = function () {
|
||||
if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) {
|
||||
// Assumes that map.hasLayer checks for direct appearance on map, not recursively calling
|
||||
// hasLayer on Layer Groups that are on map (typically not calling this MarkerClusterGroup.hasLayer, which would always return true)
|
||||
if ((map.hasLayer(layer) || map.hasLayer(layer.__parent)) && !this._inZoomAnimation) {
|
||||
this._map.off('moveend', showMarker, this);
|
||||
this.off('animationend', showMarker, this);
|
||||
|
||||
if (layer._icon) {
|
||||
if (map.hasLayer(layer)) {
|
||||
callback();
|
||||
} else if (layer.__parent._icon) {
|
||||
this.once('spiderfied', callback, this);
|
||||
|
Reference in New Issue
Block a user