From 59f9a47d4c1d1c0156db0833cf6d6cce53214578 Mon Sep 17 00:00:00 2001 From: Silvio Date: Mon, 5 Aug 2013 13:44:54 -0300 Subject: Fixing unblockUI --- gmap_arcgis.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/gmap_arcgis.js b/gmap_arcgis.js index 315fa08..fa03c1a 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -24,7 +24,6 @@ function gmapArcgis(config) { } } - // TODO: needs debug and fixing // Return a Gmap ArcGIS object return { // Storable properties @@ -42,8 +41,7 @@ function gmapArcgis(config) { } if (window.blockUI[name] != undefined && window.blockUI[name] == true) { - var index = window.blockUI.indexOf(name); - window.blockUI = window.blockUI.splice(index, 1); + delete window.blockUI[name]; } if (window.blockUI.length == 0) { @@ -140,7 +138,7 @@ function gmapArcgis(config) { }, // Add polygons from a given ArcGIS MapServer Layer - showPolygon: function(params) { + showPolygon: function(params, name) { var self = this; params.service = new gmaps.ags.MapService(params['uri']); params.overlay = new gmaps.ags.MapOverlay(params.service, { @@ -150,19 +148,17 @@ function gmapArcgis(config) { layerDefinitions: (params['layerDefinitions'] != undefined) ? params['layerDefinitions'] : { }, }, }); - + if (params.callback == undefined) { // Default callback: remove the blockUI once the layer is shown google.maps.event.addListener(params.overlay, 'drawend', function() { - // TODO - self.unblockUI(); + self.unblockUI(name); }); } else { google.maps.event.addListener(params.overlay, 'drawend', function() { params.callback(this.map, params); - // TODO - self.unblockUI(); + self.unblockUI(name); }); } @@ -276,7 +272,7 @@ function gmapArcgis(config) { } this.showOverlayIf('layers', element); - this.config['layers'][element].overlay = this.showPolygon(this.config['layers'][element]); + this.config['layers'][element].overlay = this.showPolygon(this.config['layers'][element], 'layers_' + element); }, // Add a slider layer in the map @@ -290,7 +286,7 @@ function gmapArcgis(config) { } this.showOverlayIf('sliders', slider); - this.config['sliders'][slider].overlays[layer] = this.showPolygon(this.config['sliders'][slider]); + this.config['sliders'][slider].overlays[layer] = this.showPolygon(this.config['sliders'][slider], 'sliders_' + slider); this.sliderUpdateOpacity(layer, slider); }, @@ -553,7 +549,7 @@ function gmapArcgis(config) { }, // Show a polygon resulting from the given query - showPolygonFromQuery: function(params) { + showPolygonFromQuery: function(params, name) { var self = this; var limit = null; var layer = new gmaps.ags.Layer(params.uri); @@ -604,8 +600,7 @@ function gmapArcgis(config) { self.setCenter(center, true); } - // TODO - self.unblockUI(); + self.unblockUI(name); return params.overlay; }); }, -- cgit v1.2.3