diff --git a/externs/olx.js b/externs/olx.js index 57e5d11ac5..e18753cd5b 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -4656,7 +4656,8 @@ olx.source.ServerVectorOptions.prototype.projection; /** * @typedef {{crossOrigin: (null|string|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: string}} + * url: string, + * wrapX: (boolean|undefined)}} * @api */ olx.source.TileJSONOptions; @@ -4686,6 +4687,14 @@ olx.source.TileJSONOptions.prototype.tileLoadFunction; olx.source.TileJSONOptions.prototype.url; +/** + * Whether to wrap the world horizontally. Default is `true`. + * @type {boolean|undefined} + * @api + */ +olx.source.TileJSONOptions.prototype.wrapX; + + /** * @typedef {{attributions: (Array.|undefined), * params: Object., diff --git a/src/ol/source/tilejsonsource.js b/src/ol/source/tilejsonsource.js index 0c4b4a6d5d..92982e18fc 100644 --- a/src/ol/source/tilejsonsource.js +++ b/src/ol/source/tilejsonsource.js @@ -39,6 +39,12 @@ ol.source.TileJSON = function(options) { tileLoadFunction: options.tileLoadFunction }); + /** + * @type {boolean|undefined} + * @private + */ + this.wrapX_ = options.wrapX; + var request = new goog.net.Jsonp(options.url); request.send(undefined, goog.bind(this.handleTileJSONResponse, this)); @@ -76,7 +82,8 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) { this.tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform( tileGrid.createTileCoordTransform({ - extent: extent + extent: extent, + wrapX: this.wrapX_ }), ol.TileUrlFunction.createFromTemplates(tileJSON.tiles));