Clear queue in more appropriate places.

This commit is contained in:
ahocevar
2012-01-31 12:04:03 +01:00
parent cc749a7967
commit 99a68b0d20

View File

@@ -228,6 +228,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
removeMap: function(map) {
if (this.moveTimerId !== null) {
window.clearTimeout(this.moveTimerId);
this.moveTimerId = null;
}
this.clearTileQueue();
if(this.backBufferTimerId !== null) {
@@ -325,10 +326,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
// if grid is empty or zoom has changed, we *must* re-tile
var forceReTile = !this.grid.length || zoomChanged;
if (forceReTile) {
this.clearTileQueue();
}
// total bounds of the tiles
var tilesBounds = this.getTilesBounds();
@@ -436,8 +433,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
if (this.tileQueue.length === 0) {
this.clearTileQueue();
} else {
var tile = this.tileQueue.shift();
tile.draw(true);
this.tileQueue.shift().draw(true);
}
},
@@ -704,6 +700,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* bounds - {<OpenLayers.Bounds>}
*/
initSingleTile: function(bounds) {
this.clearTileQueue();
//determine new tile bounds
var center = bounds.getCenterLonLat();
@@ -815,6 +812,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* bounds - {<OpenLayers.Bounds>}
*/
initGriddedTiles:function(bounds) {
this.clearTileQueue();
// work out mininum number of rows and columns; this is the number of
// tiles required to cover the viewport plus at least one for panning