aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gmap_arcgis.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index bc67623..19e06a5 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -115,6 +115,7 @@ function gmapArcgis(config) {
// Add polygons from a given ArcGIS MapServer Layer
showPolygon: function(params) {
+ var self = this;
params.service = new gmaps.ags.MapService(params['uri']);
params.overlay = new gmaps.ags.MapOverlay(params.service, {
exportOptions: {
@@ -124,24 +125,24 @@ function gmapArcgis(config) {
},
});
- params.overlay.setMap(this.map);
- params.overlay.setOpacity(params.opacity);
-
- this.identifyPolygon(params);
-
if (params.callback == undefined) {
// Default callback: remove the blockUI once the layer is shown
- google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
- this.unblockUI();
+ google.maps.event.addListener(params.overlay, 'drawend', function() {
+ self.unblockUI();
});
}
else {
- google.maps.event.addListener(params.overlay.getMapService(), 'update', function() {
+ google.maps.event.addListener(params.overlay, 'drawend', function() {
params.callback(this.map, params);
- this.unblockUI();
+ self.unblockUI();
});
}
+ params.overlay.setMap(this.map);
+ params.overlay.setOpacity(params.opacity);
+
+ this.identifyPolygon(params);
+
return params.overlay;
},