JacobH1994 / 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

There should be a marker existence test in the addMarker function #316

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In the function 'addMarker' from MarkerClusterer : 

MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {
  this.pushMarkerTo_(marker);
  if (!opt_nodraw) {
    this.redraw();
  }
};

It should be nice to add an existence check the same way you do in the 
Cluster.addMarker function.

Expected result : 

MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {
  var shouldAddMarker = !this.markers_.indexOf || this.markers_.indexOf(marker) == -1; 

  // add the marker only if it is not already in the markers_ tab
  if (shouldAddMarker) {
      this.pushMarkerTo_(marker);
      if (!opt_nodraw) {
        this.redraw();
      }
  } 
};

Thanks guys

Original issue reported on code.google.com by jonathan...@sigfox.com on 18 Aug 2014 at 12:41