aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gmap_arcgis.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 07a4330..190f9b3 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -46,18 +46,18 @@ function gmapArcgis(config) {
params.overlay.setMap(this.map);
params.overlay.setOpacity(params.opacity);
- // TODO: support for clickable polygons
// See https://google-maps-utility-library-v3.googlecode.com/svn/trunk/arcgislink/examples/identify.js
if (typeof params.identify != 'undefined') {
- google.maps.event.addListener(this.map, 'click', function(point) {
+ var self = this;
+ params.identifyListener = google.maps.event.addListener(this.map, 'click', function(point) {
params.identify.geometry = point.latLng;
- params.identify.bounds = this.map.getBounds();
+ params.identify.bounds = self.map.getBounds();
+ params.identify.width = self.map.getDiv().offsetWidth;
+ params.identify.height = self.map.getDiv().offsetHeight;
params.service.identify(params.identify, function(results, err) {
- if (err) {
- alert(err.message + err.details.join('\n'));
- } else {
- //addResultToMap(results, evt.latLng);
+ if (!err) {
+ params.identify.callback(results, err);
}
});
});
@@ -107,6 +107,7 @@ function gmapArcgis(config) {
addLayers: function(element) {
this.config['layers'][element].opacity = this.defaultOpacity(element);
+ // TODO: add identify listener
if (typeof this.config['layers'][element].overlay != 'undefined') {
this.config['layers'][element].overlay.setOpacity(this.config['layers'][element].opacity);
this.unblockUI();
@@ -231,6 +232,10 @@ function gmapArcgis(config) {
// Toggle layer visibility
toggleLayers: function(element) {
this.config['layers'][element].overlay.setOpacity(0);
+
+ if (this.config['layers'][element].identifyListener != undefined) {
+ google.maps.event.removeListener(this.config['layers'][element].identifyListener);
+ }
},
// Toggle marker visibility