aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gmap_arcgis.js30
1 files changed, 25 insertions, 5 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 70adb19..81df878 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -227,7 +227,11 @@ function gmapArcgis(config) {
this.config['layers'][element].opacity = this.defaultOpacity(element);
if (typeof this.config['layers'][element].overlay != 'undefined') {
- if (this.config['layers'][element].overlay.setOpacity != undefined) {
+ if (this.config['layers'][element].overlay.setVisible != undefined) {
+ this.config['layers'][element].overlay.setVisible(true);
+ this.identifyPolygon(this.config['layers'][element]);
+ }
+ else if (this.config['layers'][element].overlay.setOpacity != undefined) {
this.config['layers'][element].overlay.setOpacity(this.config['layers'][element].opacity);
this.identifyPolygon(this.config['layers'][element]);
}
@@ -362,16 +366,32 @@ function gmapArcgis(config) {
},
// Toggle layer visibility
- // TODO: it should really toggle and not just hide layers
toggleLayers: function(element) {
- if (this.config['layers'][element].overlay.setOpacity != undefined) {
- this.config['layers'][element].overlay.setOpacity(0);
+ if (this.config['layers'][element].overlay.setVisible != undefined) {
+ var changeTo = !this.config['layers'][element].overlay.getVisible();
+ this.config['layers'][element].overlay.setVisible(changeTo);
+ }
+ else if (this.config['layers'][element].overlay.setOpacity != undefined) {
+ var opacity = this.config['layers'][element].overlay.getOpacity;
+
+ if (opacity == 0) {
+ opacity = this.config['layers'][element].opacity;
+ }
+ else {
+ opacity = 0;
+ }
+
+ 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++) {
- this.config['layers'][element].overlay[i].setVisible(false);
+ var changeTo = !this.config['layers'][element].overlay[i].getVisible();
+ this.config['layers'][element].overlay[i].setVisible(changeTo);
}
}
+ else {
+ console.log(this.config['layers'][element].overlay);
+ }
if (this.config['layers'][element].identifyListener != undefined) {
google.maps.event.removeListener(this.config['layers'][element].identifyListener);