Change getUrlAsync parameters.

Instead of giving the function a bound, a scope, a property to update
and a callback, only give the bound and a callback.

When the url is retrieved by getUrlAsync, simply call the callback
with the url as argument and let the caller manage this.
This commit is contained in:
fredj
2012-01-27 13:23:08 +01:00
parent 9aa1c4450e
commit fe202cef14
3 changed files with 10 additions and 19 deletions

View File

@@ -168,15 +168,14 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
this.layer.div.appendChild(this.getTile());
if (this.layer.async) {
// Asynchronous image requests call the asynchronous getURL method
// on the layer to fetch an image that covers 'this.bounds', in the scope of
// 'this', setting the 'url' property of the layer itself, and running
// the callback 'initImage' when the image request returns.
var myId = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
this.layer.getURLasync(this.bounds, this, "url", function() {
if (myId == this.asyncRequestId) {
// on the layer to fetch an image that covers 'this.bounds'.
var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
this.layer.getURLasync(this.bounds, OpenLayers.Function.bind(function(url) {
if (id == this.asyncRequestId) {
this.url = url;
this.initImage();
}
});
}, this));
} else {
// synchronous image requests get the url immediately.
this.url = this.layer.getURL(this.bounds);