diff options
author | Silvio <silvio@socioambiental.org> | 2014-11-24 15:47:00 -0200 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2014-11-24 15:47:00 -0200 |
commit | fab344a1ac98774616705b1413ee93da08fffc2f (patch) | |
tree | 3c6a071ccfb6d8c4e2b0c71a6e239d3b454c15bc | |
parent | e05a421f0359ffdbc156d420210e10bedaaba86f (diff) | |
download | gmap_arcgis_js-fab344a1ac98774616705b1413ee93da08fffc2f.tar.gz gmap_arcgis_js-fab344a1ac98774616705b1413ee93da08fffc2f.tar.bz2 |
Trying to add cluster support on toggleMarkers()
-rw-r--r-- | gmap_arcgis.js | 24 |
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(); } }, |