From 193983b2b07b468976384a38e2f11e3cf00e19a1 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 15 Mar 2012 17:44:30 +0100 Subject: [PATCH] tileQueue has nothing to do with numLoadingTiles. The tileQueue might have entries again after zooming when the previous zoom level hasn't finished loading yet. Removing the check for the tileQueue's length makes layers report loadend correctly again. --- lib/OpenLayers/Layer/Grid.js | 2 +- tests/manual/loadend.html | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tests/manual/loadend.html diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index adf516364f..4af8ec8423 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -1061,7 +1061,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { this.numLoadingTiles--; this.events.triggerEvent("tileloaded", {tile: tile}); //if that was the last tile, then trigger a 'loadend' on the layer - if (this.tileQueue.length === 0 && this.numLoadingTiles === 0) { + if (this.numLoadingTiles === 0) { this.events.triggerEvent("loadend"); if(this.backBuffer) { // the removal of the back buffer is delayed to prevent flash diff --git a/tests/manual/loadend.html b/tests/manual/loadend.html new file mode 100644 index 0000000000..0536b75d3e --- /dev/null +++ b/tests/manual/loadend.html @@ -0,0 +1,73 @@ + + + + + + + + + + + + +

WMS loadstart/loadend events

+ +
+ wms, layer, singletile +
+

+ Shows the loadstart and loadend events of a WMS layer +

+ +
+ +
+

+ This example is helpful in testing whether all loadstart events are followed + by a loadend event. + Test by using scroll-wheel up and down. +

+
+ +

loadstart and loadend events

+

+
+  
+
\ No newline at end of file