diff --git a/externs/olx.js b/externs/olx.js index d904360674..a722852e4a 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -3393,7 +3393,8 @@ olx.source; * key: string, * imagerySet: string, * maxZoom: (number|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined)}} + * tileLoadFunction: (ol.TileLoadFunctionType|undefined), + * wrapX: (boolean|undefined)}} * @api */ olx.source.BingMapsOptions; @@ -3439,6 +3440,15 @@ olx.source.BingMapsOptions.prototype.maxZoom; */ olx.source.BingMapsOptions.prototype.tileLoadFunction; + +/** + * Whether to wrap the world horizontally. Default is `true`. + * @type {boolean|undefined} + * @api + */ +olx.source.BingMapsOptions.prototype.wrapX; + + /** * @typedef {{attributions: (Array.|undefined), * distance: (number|undefined), diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js index fdcb439a4d..f025874a8f 100644 --- a/src/ol/source/bingmapssource.js +++ b/src/ol/source/bingmapssource.js @@ -48,6 +48,12 @@ ol.source.BingMaps = function(options) { */ this.maxZoom_ = goog.isDef(options.maxZoom) ? options.maxZoom : -1; + /** + * @private + * @type {boolean} + */ + this.wrapX_ = goog.isDef(options.wrapX) ? options.wrapX : true; + var protocol = ol.IS_HTTPS ? 'https:' : 'http:'; var uri = new goog.Uri( protocol + '//dev.virtualearth.net/REST/v1/Imagery/Metadata/' + @@ -108,7 +114,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = var culture = this.culture_; this.tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform( - tileGrid.createTileCoordTransform(), + tileGrid.createTileCoordTransform({wrapX: this.wrapX_}), ol.TileUrlFunction.createFromTileUrlFunctions( goog.array.map( resource.imageUrlSubdomains,