Skip to content

Commit

Permalink
Fix some cases where zoomToShowLayer wouldn't work. Fixes #286 #228 #203
Browse files Browse the repository at this point in the history
  • Loading branch information
danzel committed Dec 19, 2013
1 parent 7e31b27 commit f0b1618
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/MarkerClusterGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f0b1618

Please sign in to comment.