Give ol.Image an imageLoadFunction argument

This commit is contained in:
Andreas Hocevar
2014-10-29 20:07:00 +01:00
parent 87a06c0086
commit 46eb14dc96
2 changed files with 32 additions and 3 deletions

View File

@@ -20,9 +20,10 @@ goog.require('ol.extent');
* @param {Array.<ol.Attribution>} attributions Attributions.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
*/
ol.Image =
function(extent, resolution, pixelRatio, attributions, src, crossOrigin) {
ol.Image = function(extent, resolution, pixelRatio, attributions, src,
crossOrigin, imageLoadFunction) {
goog.base(this, extent, resolution, pixelRatio, ol.ImageState.IDLE,
attributions);
@@ -59,6 +60,13 @@ ol.Image =
* @type {ol.ImageState}
*/
this.state = ol.ImageState.IDLE;
/**
* @private
* @type {ol.ImageLoadFunctionType}
*/
this.imageLoadFunction_ = imageLoadFunction;
};
goog.inherits(ol.Image, ol.ImageBase);
@@ -127,7 +135,7 @@ ol.Image.prototype.load = function() {
goog.events.listenOnce(this.image_, goog.events.EventType.LOAD,
this.handleImageLoad_, false, this)
];
this.image_.src = this.src_;
this.imageLoadFunction_(this, this.src_);
}
};