vendor/assets/javascripts/map.js in flashgrid-3.3.2 vs vendor/assets/javascripts/map.js in flashgrid-3.4.0

- old
+ new

@@ -723,24 +723,41 @@ GMaps.prototype.removeMarkers = function (collection) { var new_markers = []; 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 index = this.markers.indexOf(collection[i]); + + if (index > -1) { + var marker = this.markers[index]; + marker.setMap(null); + + if(this.markerClusterer) { + this.markerClusterer.removeMarker(marker); + } + + GMaps.fire('marker_removed', marker, this); } } for (var i = 0; i < this.markers.length; i++) { - if (this.markers[i].getMap() != null) { - new_markers.push(this.markers[i]); + var marker = this.markers[i]; + if (marker.getMap() != null) { + new_markers.push(marker); } } this.markers = new_markers; } \ No newline at end of file