Compute number of new tiles to load exactly
This commit is contained in:
@@ -80,15 +80,16 @@ ol.TileQueue.prototype.handleTileChange = function() {
|
|||||||
* @param {number} maxNewLoads Maximum number of new tiles to load.
|
* @param {number} maxNewLoads Maximum number of new tiles to load.
|
||||||
*/
|
*/
|
||||||
ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
|
ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
|
||||||
var tile;
|
var newLoads = Math.min(
|
||||||
while (maxNewLoads > 0 &&
|
maxTotalLoading - this.getTilesLoading(), maxNewLoads, this.getCount());
|
||||||
!this.isEmpty() &&
|
if (newLoads > 0) {
|
||||||
this.tilesLoading_ < maxTotalLoading) {
|
var i, tile;
|
||||||
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
|
for (i = 0; i < newLoads; ++i) {
|
||||||
goog.events.listenOnce(tile, goog.events.EventType.CHANGE,
|
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
|
||||||
this.handleTileChange, false, this);
|
goog.events.listenOnce(tile, goog.events.EventType.CHANGE,
|
||||||
tile.load();
|
this.handleTileChange, false, this);
|
||||||
++this.tilesLoading_;
|
tile.load();
|
||||||
--maxNewLoads;
|
}
|
||||||
|
this.tilesLoading_ += newLoads;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user