aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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++) {