Add crossOrigin option to ol.source.OSM options
This commit is contained in:
@@ -665,6 +665,8 @@
|
|||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.source.OSMOptions
|
* @typedef {Object} ol.source.OSMOptions
|
||||||
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
||||||
|
* @property {null|string|undefined} crossOrigin crossOrigin setting for image
|
||||||
|
* requests. Default is `anonymous`.
|
||||||
* @property {number|undefined} maxZoom Max zoom.
|
* @property {number|undefined} maxZoom Max zoom.
|
||||||
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
||||||
* function to load a tile given a URL.
|
* function to load a tile given a URL.
|
||||||
|
|||||||
@@ -22,12 +22,15 @@ ol.source.OSM = function(opt_options) {
|
|||||||
attributions = ol.source.OSM.ATTRIBUTIONS;
|
attributions = ol.source.OSM.ATTRIBUTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var crossOrigin = goog.isDef(options.crossOrigin) ?
|
||||||
|
options.crossOrigin : 'anonymous';
|
||||||
|
|
||||||
var url = goog.isDef(options.url) ?
|
var url = goog.isDef(options.url) ?
|
||||||
options.url : 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
options.url : 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: attributions,
|
attributions: attributions,
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: crossOrigin,
|
||||||
opaque: true,
|
opaque: true,
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
tileLoadFunction: options.tileLoadFunction,
|
tileLoadFunction: options.tileLoadFunction,
|
||||||
|
|||||||
Reference in New Issue
Block a user