Tile renderers needn't listen for tile change

This commit is contained in:
Éric Lemoine
2013-03-20 22:58:03 +01:00
parent 7038ac0c81
commit 1d575309da
6 changed files with 22 additions and 39 deletions

View File

@@ -30,8 +30,10 @@ ol.TilePriorityFunction;
* @constructor
* @param {ol.TilePriorityFunction} tilePriorityFunction
* Tile priority function.
* @param {Function} tileChangeCallback
* Function called on each tile change event.
*/
ol.TileQueue = function(tilePriorityFunction) {
ol.TileQueue = function(tilePriorityFunction, tileChangeCallback) {
/**
* @private
@@ -39,6 +41,12 @@ ol.TileQueue = function(tilePriorityFunction) {
*/
this.tilePriorityFunction_ = tilePriorityFunction;
/**
* @private
* @type {Function}
*/
this.tileChangeCallback_ = tileChangeCallback;
/**
* @private
* @type {number}
@@ -120,6 +128,7 @@ ol.TileQueue.prototype.enqueue = function(tile, tileSourceKey, tileCenter) {
*/
ol.TileQueue.prototype.handleTileChange = function() {
--this.tilesLoading_;
this.tileChangeCallback_();
};
@@ -168,7 +177,7 @@ ol.TileQueue.prototype.heapify_ = function() {
/**
* @return {boolean} New loading tiles?
* FIXME empty description for jsdoc
*/
ol.TileQueue.prototype.loadMoreTiles = function() {
var tile;
@@ -179,7 +188,6 @@ ol.TileQueue.prototype.loadMoreTiles = function() {
tile.load();
++this.tilesLoading_;
}
return goog.isDef(tile);
};