Fix some cases where zoomToShowLayer wouldn't work. Fixes #286 #228 #203

This commit is contained in:
danzel
2013-12-19 16:03:55 +13:00
parent 7e31b27f68
commit f0b1618e07
+2 -4
View File
@@ -378,14 +378,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
};
if (layer._icon) {
if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
callback();
} else if (layer.__parent._zoom < this._map.getZoom()) {
//Layer should be visible now but isn't on screen, just pan over to it
this._map.on('moveend', showMarker, this);
if (!layer._icon) {
this._map.panTo(layer.getLatLng());
}
this._map.panTo(layer.getLatLng());
} else {
this._map.on('moveend', showMarker, this);
this.on('animationend', showMarker, this);