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

@@ -271,7 +271,8 @@ ol.Map = function(mapOptions) {
* @private
* @type {ol.TileQueue}
*/
this.tileQueue_ = new ol.TileQueue(goog.bind(this.getTilePriority, this));
this.tileQueue_ = new ol.TileQueue(goog.bind(this.getTilePriority, this),
goog.bind(this.handleTileChange_, this));
goog.events.listen(this, ol.Object.getChangedEventType(ol.MapProperty.VIEW),
this.handleViewChanged_, false, this);
@@ -543,13 +544,7 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
*/
ol.Map.prototype.handlePostRender = function() {
this.tileQueue_.reprioritize(); // FIXME only call if needed
var moreLoadingTiles = this.tileQueue_.loadMoreTiles();
if (moreLoadingTiles) {
// The tile layer renderers need to know when tiles change
// to the LOADING state (to register the change listener
// on the tile).
this.requestRenderFrame();
}
this.tileQueue_.loadMoreTiles();
var postRenderFunctions = this.postRenderFunctions_;
var i;
@@ -585,6 +580,14 @@ ol.Map.prototype.handleSizeChanged_ = function() {
};
/**
* @private
*/
ol.Map.prototype.handleTileChange_ = function() {
this.requestRenderFrame();
};
/**
* @private
*/