Allow tile load function to be overridden
This commit is contained in:
+11
-2
@@ -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_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user