diff options
Diffstat (limited to 'gmap_arcgis.js')
-rw-r--r-- | gmap_arcgis.js | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js index e6e35b5..3449a8e 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -311,7 +311,8 @@ function gmapArcgis(config) { this.toggleMarkers(element); return; } else { - this.config['markers'][element].overlay = []; + this.config['markers'][element].overlay = []; + self.config['markers'][element].listener = []; } this.showOverlayIf('markers', element); @@ -354,7 +355,7 @@ function gmapArcgis(config) { } self.config['markers'][element].overlay[i] = {}; - self.config['markers'][element].overlay[i].marker = new google.maps.Marker({ + self.config['markers'][element].overlay[i] = new google.maps.Marker({ title: title, icon: self.config['markers'][element].icon, position: feature.geometry[0].getPosition(), @@ -362,8 +363,8 @@ function gmapArcgis(config) { }); // Use a closure so marker data remains available to the listeners - self.config['markers'][element].overlay[i].addListener = function() { - var marker = self.config['markers'][element].overlay[i].marker; + self.config['markers'][element].listener[i] = function() { + var marker = self.config['markers'][element].overlay[i]; var infowindow = self.config['markers'][element].infowindow; var content = self.config['markers'][element].content; var attributes = feature.attributes; @@ -376,17 +377,11 @@ function gmapArcgis(config) { }; // Execute - self.config['markers'][element].overlay[i].addListener(); + self.config['markers'][element].listener[i](); } if (cluster == true) { - var markers = []; - - for (var i = 0; i < self.config['markers'][element].overlay.length; i++) { - markers.push(self.config['markers'][element].overlay[i].marker); - } - - self.config['markers'][element].cluster = new MarkerClusterer(self.map, markers); + self.config['markers'][element].cluster = new MarkerClusterer(self.map, self.config['markers'][element].overlay); } self.unblockUI('markers_' + element); @@ -442,11 +437,11 @@ function gmapArcgis(config) { var closeInfoWindow = false; for (i=0; i < markers.length; i++) { - if (markers[i].marker.getVisible()) { + if (markers[i].getVisible()) { closeInfoWindow = true; - markers[i].marker.setVisible(false); + markers[i].setVisible(false); } else { - markers[i].marker.setVisible(true); + markers[i].setVisible(true); } } |