phannack/google-maps-utility-library-v3

There should be a marker existence test in the addMarker function

Opened this issue · 0 comments

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