patch for #831 - simplify the notion of untiled (now an option on grid layers called 'singleTile') and implementing loading events for gridded/untiled layers. thanks tim and chris for reviewing this beast.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3725 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -96,6 +96,15 @@ OpenLayers.Tile.Image.prototype =
|
||||
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isLoading) {
|
||||
//if we're already loading, send 'reload' instead of 'loadstart'.
|
||||
this.events.triggerEvent("reload");
|
||||
} else {
|
||||
this.isLoading = true;
|
||||
this.events.triggerEvent("loadstart");
|
||||
}
|
||||
|
||||
if (this.imgDiv == null) {
|
||||
this.initImgDiv();
|
||||
}
|
||||
@@ -202,6 +211,23 @@ OpenLayers.Tile.Image.prototype =
|
||||
// we need this reference to check back the viewRequestID
|
||||
this.imgDiv.map = this.layer.map;
|
||||
|
||||
//bind a listener to the onload of the image div so that we
|
||||
// can register when a tile has finished loading.
|
||||
var onload = function() {
|
||||
|
||||
//normally isLoading should always be true here but there are some
|
||||
// right funky conditions where loading and then reloading a tile
|
||||
// with the same url *really*fast*. this check prevents sending
|
||||
// a 'loadend' if the msg has already been sent
|
||||
//
|
||||
if (this.isLoading) {
|
||||
this.isLoading = false;
|
||||
this.events.triggerEvent("loadend");
|
||||
}
|
||||
}
|
||||
OpenLayers.Event.observe(this.imgDiv, 'load',
|
||||
onload.bindAsEventListener(this));
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user