aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gmap_arcgis.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 3449a8e..edc0ea1 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -381,7 +381,9 @@ function gmapArcgis(config) {
}
if (cluster == true) {
- self.config['markers'][element].cluster = new MarkerClusterer(self.map, self.config['markers'][element].overlay);
+ self.config['markers'][element].cluster = new MarkerClusterer(self.map,
+ self.config['markers'][element].overlay,
+ { ignoreHidden: true });
}
self.unblockUI('markers_' + element);
@@ -432,23 +434,29 @@ function gmapArcgis(config) {
},
// Toggle marker visibility
- toggleMarkers: function(element, raw) {
- var markers = (raw == true) ? element : this.config['markers'][element].overlay;
- var closeInfoWindow = false;
+ toggleMarkers: function(element, raw, cluster) {
+ var markers = (raw == true) ? element : this.config['markers'][element].overlay;
+ var isVisible = false;
+ // Hide/show each marker
for (i=0; i < markers.length; i++) {
if (markers[i].getVisible()) {
- closeInfoWindow = true;
+ isVisible = true;
markers[i].setVisible(false);
} else {
markers[i].setVisible(true);
}
}
+ // Process clusters
+ if (cluster == true) {
+ this.config['markers'][element].cluster.repaint();
+ }
+
// Close the infoWindow
- if (closeInfoWindow == true && this.config['markers'] != undefined
- && this.config['markers'][element] != undefined
- && this.config['markers'][element].infowindow != undefined) {
+ if (isVisible == true && this.config['markers'] != undefined
+ && this.config['markers'][element] != undefined
+ && this.config['markers'][element].infowindow != undefined) {
this.config['markers'][element].infowindow.close();
}
},