aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2016-02-24 17:45:23 -0300
committerSilvio <silvio@socioambiental.org>2016-02-24 17:45:23 -0300
commitc6a7dfcade57225a6bed0fbd258a57865e419b3e (patch)
treeb556622fbcbf1984a71fdd795ca4895bf4ad1066
parent28d98f0c7a192e127f8d079cce96635f04129e3f (diff)
downloadgmap_arcgis_js-c6a7dfcade57225a6bed0fbd258a57865e419b3e.tar.gz
gmap_arcgis_js-c6a7dfcade57225a6bed0fbd258a57865e419b3e.tar.bz2
More variable testing
-rw-r--r--gmap_arcgis.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 55c6b71..7314f70 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -436,11 +436,14 @@ function gmapArcgis(config) {
// Toggle layer visibility
toggleLayers: function(element) {
- if (this.config['layers'][element] != undefined && this.config['layers'][element].overlay != undefined && this.config['layers'][element].overlay.setVisible != undefined) {
+ if (this.config['layers'][element] == undefined || this.config['layers'][element].overlay == undefined) {
+ return;
+ }
+ else 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 != undefined && this.config['layers'][element].overlay.setOpacity != undefined) {
+ else if (this.config['layers'][element].overlay.setOpacity != undefined) {
var opacity = this.config['layers'][element].overlay.getOpacity;
if (opacity == 0) {
@@ -479,9 +482,21 @@ function gmapArcgis(config) {
// Toggle marker visibility
toggleMarkers: function(element, raw, cluster) {
- var markers = (raw == true) ? element : this.config['markers'][element].overlay;
var isVisible = false;
var mark;
+ var markers;
+
+ if (raw == true) {
+ markers = element;
+ }
+ else if (this.config['markers'][element] != undefined && this.config['markers'][element].overlay != undefined) {
+ markers = this.config['markers'][element].overlay;
+ }
+ else {
+ return;
+ }
+
+ var markers = (raw == true) ? element : this.config['markers'][element].overlay;
// Hide/show each marker
for (var i=0; i < markers.length; i++) {