From 5388657791e832a7574a139b15102297789d3ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 21 Jun 2012 19:36:59 +0200 Subject: [PATCH] [ol.Tile] a tile can be loaded only once --- src/ol/Tile.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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_; };