Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
Fix #363
Browse files Browse the repository at this point in the history
  • Loading branch information
hpneo committed Nov 13, 2014
1 parent 44ef4e3 commit 85e1e4d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/gmaps.markers.js
Expand Up @@ -170,15 +170,29 @@ GMaps.prototype.removeMarkers = function (collection) {

if (typeof collection == 'undefined') {
for (var i = 0; i < this.markers.length; i++) {
this.markers[i].setMap(null);
var marker = this.markers[i];
marker.setMap(null);

if(this.markerClusterer) {
this.markerClusterer.removeMarker(marker);
}

GMaps.fire('marker_removed', marker, this);
}

this.markers = new_markers;
}
else {
for (var i = 0; i < collection.length; i++) {
if (this.markers.indexOf(collection[i]) > -1) {
this.markers[i].setMap(null);
var marker = this.markers[i];
marker.setMap(null);

if(this.markerClusterer) {
this.markerClusterer.removeMarker(marker);
}

GMaps.fire('marker_removed', marker, this);
}
}

Expand Down

0 comments on commit 85e1e4d

Please sign in to comment.