diff --git a/src/ol/Tile.js b/src/ol/Tile.js index 584a5cfcf1..46d67c2b35 100644 --- a/src/ol/Tile.js +++ b/src/ol/Tile.js @@ -1,6 +1,7 @@ goog.provide('ol.Tile'); goog.require('goog.events'); +goog.require('goog.asserts'); goog.require('ol.Bounds'); goog.require('ol.event.Events'); @@ -30,6 +31,12 @@ ol.Tile = function(url, bounds) { */ this.loaded_ = false; + /** + * @private + * @type {boolean} + */ + this.loading_ = false; + /** * @private * @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() { + goog.asserts.assert(!this.loaded && this.loading_); + this.loading_ = true; this.img_.src = this.url_; };