diff --git a/externs/olx.js b/externs/olx.js index cfa4b74379..b2d541371e 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -3863,6 +3863,7 @@ olx.source.IGCOptions.prototype.urls; * projection: ol.proj.ProjectionLike, * ratio: (number|undefined), * resolutions: (Array.|undefined), + * imageLoadFunction: (ol.ImageLoadFunctionType|undefined), * params: (Object|undefined)}} * @api */ diff --git a/src/ol/source/imagemapguidesource.js b/src/ol/source/imagemapguidesource.js index 27c7adac6a..3d7c18f11f 100644 --- a/src/ol/source/imagemapguidesource.js +++ b/src/ol/source/imagemapguidesource.js @@ -3,6 +3,7 @@ goog.provide('ol.source.ImageMapGuide'); goog.require('goog.object'); goog.require('goog.uri.utils'); goog.require('ol.Image'); +goog.require('ol.ImageLoadFunctionType'); goog.require('ol.ImageUrlFunction'); goog.require('ol.extent'); goog.require('ol.source.Image'); @@ -59,6 +60,13 @@ ol.source.ImageMapGuide = function(options) { */ this.imageUrlFunction_ = imageUrlFunction; + /** + * @private + * @type {ol.ImageLoadFunctionType} + */ + this.imageLoadFunction_ = goog.isDef(options.imageLoadFunction) ? + options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction; + /** * @private * @type {boolean} @@ -140,7 +148,8 @@ ol.source.ImageMapGuide.prototype.getImage = var imageUrl = this.imageUrlFunction_(extent, size, projection); if (goog.isDef(imageUrl)) { image = new ol.Image(extent, resolution, pixelRatio, - this.getAttributions(), imageUrl, this.crossOrigin_); + this.getAttributions(), imageUrl, this.crossOrigin_, + this.imageLoadFunction_); } else { image = null; }