Merge pull request #322 from ahocevar/loadend
WMS loadend event does not always fire. r=@elemoine
This commit is contained in:
@@ -138,6 +138,12 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
*/
|
*/
|
||||||
tileQueue: null,
|
tileQueue: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: loading
|
||||||
|
* {Boolean} Indicates if tiles are being loaded.
|
||||||
|
*/
|
||||||
|
loading: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: backBuffer
|
* Property: backBuffer
|
||||||
* {DOMElement} The back buffer.
|
* {DOMElement} The back buffer.
|
||||||
@@ -1050,7 +1056,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
|
|
||||||
tile.onLoadStart = function() {
|
tile.onLoadStart = function() {
|
||||||
//if that was first tile then trigger a 'loadstart' on the layer
|
//if that was first tile then trigger a 'loadstart' on the layer
|
||||||
if (this.numLoadingTiles == 0) {
|
if (this.loading === false) {
|
||||||
|
this.loading = true;
|
||||||
this.events.triggerEvent("loadstart");
|
this.events.triggerEvent("loadstart");
|
||||||
}
|
}
|
||||||
this.events.triggerEvent("tileloadstart", {tile: tile});
|
this.events.triggerEvent("tileloadstart", {tile: tile});
|
||||||
@@ -1061,7 +1068,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
this.numLoadingTiles--;
|
this.numLoadingTiles--;
|
||||||
this.events.triggerEvent("tileloaded", {tile: tile});
|
this.events.triggerEvent("tileloaded", {tile: tile});
|
||||||
//if that was the last tile, then trigger a 'loadend' on the layer
|
//if that was the last tile, then trigger a 'loadend' on the layer
|
||||||
if (this.numLoadingTiles === 0) {
|
if (this.tileQueue.length === 0 && this.numLoadingTiles === 0) {
|
||||||
|
this.loading = false;
|
||||||
this.events.triggerEvent("loadend");
|
this.events.triggerEvent("loadend");
|
||||||
if(this.backBuffer) {
|
if(this.backBuffer) {
|
||||||
// the removal of the back buffer is delayed to prevent flash
|
// the removal of the back buffer is delayed to prevent flash
|
||||||
|
|||||||
Reference in New Issue
Block a user