[ol.Tile] add a isLoaded function

This commit is contained in:
Éric Lemoine
2012-06-21 19:10:09 +02:00
parent 79f5339573
commit 6c76f4621e
2 changed files with 19 additions and 0 deletions

View File

@@ -24,6 +24,12 @@ ol.Tile = function(url, bounds) {
*/
this.bounds_ = bounds;
/**
* @private
* @type {boolean}
*/
this.loaded_ = false;
/**
* @private
* @type {HTMLImageElement}
@@ -77,6 +83,7 @@ ol.Tile.prototype.getImg = function() {
* @param {goog.events.BrowserEvent} evt Event.
*/
ol.Tile.prototype.handleImageLoad = function(evt) {
this.loaded_ = true;
this.events_.triggerEvent('load');
};
@@ -88,6 +95,14 @@ ol.Tile.prototype.handleImageError = function(evt) {
this.events_.triggerEvent('error');
};
/**
* Is the tile loaded already?
* @return {boolean}
*/
ol.Tile.prototype.isLoaded = function() {
return this.loaded_;
};
/**
*
*/