From ea8ad4fc165244e4083fdc9591aa2c80bb9263dc Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Wed, 16 Sep 2015 17:28:16 +0900 Subject: [PATCH] Make ol.control.OverviewMap's view configurable This is useful for creating an OverviewMap in a different projection than EPSG:3857. --- externs/olx.js | 18 ++++++++++++++---- src/ol/control/overviewmapcontrol.js | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 4e5fcedb2a..68fd65dd10 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -1160,7 +1160,8 @@ olx.control.MousePositionOptions.prototype.undefinedHTML; * layers: (Array.|ol.Collection|undefined), * render: (function(ol.MapEvent)|undefined), * target: (Element|undefined), - * tipLabel: (string|undefined)}} + * tipLabel: (string|undefined), + * view: (ol.View|undefined)}} * @api */ olx.control.OverviewMapOptions; @@ -1236,6 +1237,15 @@ olx.control.OverviewMapOptions.prototype.target; olx.control.OverviewMapOptions.prototype.tipLabel; +/** + * Custom view for the overview map. If not provided, a default view with + * an EPSG:3857 projection will be used. + * @type {ol.View|undefined} + * @api + */ +olx.control.OverviewMapOptions.prototype.view; + + /** * @typedef {{className: (string|undefined), * minWidth: (number|undefined), @@ -4241,7 +4251,7 @@ olx.source.ImageMapGuideOptions.prototype.projection; /** * Ratio. `1` means image requests are the size of the map viewport, `2` means - * twice the width and height of the map viewport, and so on. Must be `1` or + * twice the width and height of the map viewport, and so on. Must be `1` or * higher. Default is `1`. * @type {number|undefined} * @api stable @@ -4524,7 +4534,7 @@ olx.source.ImageVectorOptions.prototype.projection; /** * Ratio. 1 means canvases are the size of the map viewport, 2 means twice the - * width and height of the map viewport, and so on. Must be `1` or higher. + * width and height of the map viewport, and so on. Must be `1` or higher. * Default is `1.5`. * @type {number|undefined} * @api @@ -4708,7 +4718,7 @@ olx.source.ImageWMSOptions.prototype.projection; /** * Ratio. `1` means image requests are the size of the map viewport, `2` means - * twice the width and height of the map viewport, and so on. Must be `1` or + * twice the width and height of the map viewport, and so on. Must be `1` or * higher. Default is `1.5`. * @type {number|undefined} * @api stable diff --git a/src/ol/control/overviewmapcontrol.js b/src/ol/control/overviewmapcontrol.js index 15a0624579..8e7f8bb62d 100644 --- a/src/ol/control/overviewmapcontrol.js +++ b/src/ol/control/overviewmapcontrol.js @@ -99,7 +99,8 @@ ol.control.OverviewMap = function(opt_options) { this.ovmap_ = new ol.Map({ controls: new ol.Collection(), interactions: new ol.Collection(), - target: ovmapDiv + target: ovmapDiv, + view: options.view }); var ovmap = this.ovmap_;