scottpunshon / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

MarkerclustererPlus: fitMapToMarkers method doesn't take into account ignoreHidden option #310

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Expected result:
Fit to bounds of visible markers only, when ignoreHidden option is set to false.

Actual result:
All markers are taken into account, visible or not.

Version: 2.1.2 [May 28, 2014]

Additional comments:

Possible solution, adding a simple IF statement:

MarkerClusterer.prototype.fitMapToMarkers = function () {
  var i;
  var markers = this.getMarkers();
  var bounds = new google.maps.LatLngBounds();
  for (i = 0; i < markers.length; i++) {
      if (!this.ignoreHidden_ || markers[i].getVisible()){
        bounds.extend(markers[i].getPosition());
      }
  }
  this.getMap().fitBounds(bounds);
};

Original issue reported on code.google.com by albert.p...@interactiu.cat on 11 Jun 2014 at 2:16

GoogleCodeExporter commented 9 years ago
Possible solutions works great

Original comment by will...@hollebrand.se on 24 Feb 2015 at 9:15