[ol.Tile] a tile can be loaded only once

This commit is contained in:
Éric Lemoine
2012-06-21 19:36:59 +02:00
parent ed62cc00a7
commit 5388657791
+10 -1
View File
@@ -1,6 +1,7 @@
goog.provide('ol.Tile'); goog.provide('ol.Tile');
goog.require('goog.events'); goog.require('goog.events');
goog.require('goog.asserts');
goog.require('ol.Bounds'); goog.require('ol.Bounds');
goog.require('ol.event.Events'); goog.require('ol.event.Events');
@@ -30,6 +31,12 @@ ol.Tile = function(url, bounds) {
*/ */
this.loaded_ = false; this.loaded_ = false;
/**
* @private
* @type {boolean}
*/
this.loading_ = false;
/** /**
* @private * @private
* @type {HTMLImageElement} * @type {HTMLImageElement}
@@ -48,9 +55,11 @@ ol.Tile = function(url, bounds) {
}; };
/** /**
* Load the tile. * Load the tile. A tile should loaded only once.
*/ */
ol.Tile.prototype.load = function() { ol.Tile.prototype.load = function() {
goog.asserts.assert(!this.loaded && this.loading_);
this.loading_ = true;
this.img_.src = this.url_; this.img_.src = this.url_;
}; };