aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2014-12-03 11:57:20 -0200
committerSilvio <silvio@socioambiental.org>2014-12-03 11:57:20 -0200
commitd424102b6f95e5fa6bf63b349daaea42147cf77a (patch)
treed4d73e924177bff1e5089f91f4b1f780737f4594
parent3f34430ab2474f90ef31e13208b457e80d009e08 (diff)
downloadgmap_arcgis_js-d424102b6f95e5fa6bf63b349daaea42147cf77a.tar.gz
gmap_arcgis_js-d424102b6f95e5fa6bf63b349daaea42147cf77a.tar.bz2
toggleLayers: support for layers from showPolygonFromQueryMultiple
-rw-r--r--gmap_arcgis.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 810d04a..e9e4070 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -434,10 +434,23 @@ function gmapArcgis(config) {
this.config['layers'][element].overlay.setOpacity(opacity);
}
- else if (this.config['layers'][element].overlay[0] != undefined) {
- for (i=0; i < this.config['layers'][element].overlay.length; i++) {
- var changeTo = !this.config['layers'][element].overlay[i].getVisible();
- this.config['layers'][element].overlay[i].setVisible(changeTo);
+ else if (jQuery.isArray(this.config['layers'][element].overlay)) {
+ for (var i in this.config['layers'][element].overlay) {
+
+ if (this.config['layers'][element].overlay[i].getVisible != undefined) {
+ var changeTo = !this.config['layers'][element].overlay[i].getVisible();
+ this.config['layers'][element].overlay[i].setVisible(changeTo);
+ }
+
+ // Nested layers from showPolygonFromQueryMultiple
+ if (jQuery.isArray(this.config['layers'][element].overlay[i])) {
+ for (var j in this.config['layers'][element].overlay[i]) {
+ if (this.config['layers'][element].overlay[i][j].getVisible != undefined) {
+ var changeTo = !this.config['layers'][element].overlay[i][j].getVisible();
+ this.config['layers'][element].overlay[i][j].setVisible(changeTo);
+ }
+ }
+ }
}
}