Allow tile load function to be overridden

This commit is contained in:
Tom Payne
2013-09-18 13:39:42 +01:00
parent 0085623eee
commit 6896e920f9
2 changed files with 31 additions and 3 deletions
+11 -2
View File
@@ -7,6 +7,7 @@ goog.require('goog.events.EventType');
goog.require('goog.object');
goog.require('ol.Tile');
goog.require('ol.TileCoord');
goog.require('ol.TileLoadFunctionType');
goog.require('ol.TileState');
@@ -18,8 +19,10 @@ goog.require('ol.TileState');
* @param {ol.TileState} state State.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
*/
ol.ImageTile = function(tileCoord, state, src, crossOrigin) {
ol.ImageTile =
function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
goog.base(this, tileCoord, state);
@@ -52,6 +55,12 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin) {
*/
this.imageListenerKeys_ = null;
/**
* @private
* @type {ol.TileLoadFunctionType}
*/
this.tileLoadFunction_ = tileLoadFunction;
};
goog.inherits(ol.ImageTile, ol.Tile);
@@ -127,7 +136,7 @@ ol.ImageTile.prototype.load = function() {
goog.events.listenOnce(this.image_, goog.events.EventType.LOAD,
this.handleImageLoad_, false, this)
];
this.image_.src = this.src_;
this.tileLoadFunction_(this, this.src_);
}
};