[ol.Tile] a tile can be loaded only once
This commit is contained in:
+10
-1
@@ -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_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user