Consistency with tile loading events.
Since loadstart is being fired here, it makes sense to fire loadend as well. The isLoading flag also needs to be cleared. Needs tests still.
This commit is contained in:
@@ -95,6 +95,8 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
var ols = new OpenLayers.Protocol.Script({
|
||||
url: this.url,
|
||||
callback: function(response) {
|
||||
this.isLoading = false;
|
||||
this.events.triggerEvent("loadend");
|
||||
this.json = response.data;
|
||||
},
|
||||
scope: this
|
||||
@@ -104,7 +106,13 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
// Use standard XHR
|
||||
OpenLayers.Request.GET({
|
||||
url: this.url,
|
||||
callback: this.parseData,
|
||||
callback: function(response) {
|
||||
this.isLoading = false;
|
||||
this.events.triggerEvent("loadend");
|
||||
if (response.status === 200) {
|
||||
this.parseData(response);
|
||||
}
|
||||
},
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
@@ -122,12 +130,10 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
* {Object} parsed javascript data
|
||||
*/
|
||||
parseData: function(req) {
|
||||
if (req.status == 200) {
|
||||
if (!this.format) {
|
||||
this.format = new OpenLayers.Format.JSON();
|
||||
}
|
||||
this.json = this.format.read(req.responseText);
|
||||
}
|
||||
if (!this.format) {
|
||||
this.format = new OpenLayers.Format.JSON();
|
||||
}
|
||||
this.json = this.format.read(req.responseText);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user