From 6cebaf2665a4d2cf72afc09ea6582e4dcea4a4d3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 11:21:24 -0600 Subject: [PATCH] Move OverviewMapOptions to ol/control/OverviewMap --- externs/olx.js | 93 ----------------------------------- externs/xol.js | 21 -------- src/ol/control/OverviewMap.js | 28 ++++++++++- 3 files changed, 27 insertions(+), 115 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 4d051eca9d..a6ed968a46 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,99 +5,6 @@ let olx; -/** - * @typedef {{collapsed: (boolean|undefined), - * collapseLabel: (string|Element|undefined), - * collapsible: (boolean|undefined), - * label: (string|Element|undefined), - * layers: (Array.|ol.Collection.|undefined), - * render: (function(ol.MapEvent)|undefined), - * target: (Element|string|undefined), - * tipLabel: (string|undefined), - * view: (ol.View|undefined)}} - */ -olx.control.OverviewMapOptions; - - -/** - * Whether the control should start collapsed or not (expanded). - * Default to `true`. - * @type {boolean|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.collapsed; - - -/** - * Text label to use for the expanded overviewmap button. Default is `«`. - * Instead of text, also an element (e.g. a `span` element) can be used. - * @type {string|Element|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.collapseLabel; - - -/** - * Whether the control can be collapsed or not. Default to `true`. - * @type {boolean|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.collapsible; - - -/** - * Text label to use for the collapsed overviewmap button. Default is `»`. - * Instead of text, also an element (e.g. a `span` element) can be used. - * @type {string|Element|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.label; - - -/** - * Layers for the overview map. If not set, then all main map layers are used - * instead. - * @type {Array.|ol.Collection.|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.layers; - - -/** - * Function called when the control should be re-rendered. This is called - * in a requestAnimationFrame callback. - * @type {function(ol.MapEvent)|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.render; - - -/** - * Specify a target if you want the control to be rendered outside of the map's - * viewport. - * @type {Element|string|undefined} - * @api - */ -olx.control.OverviewMapOptions.prototype.target; - - -/** - * Text label to use for the button tip. Default is `Overview map` - * @type {string|undefined} - * @api - */ -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), diff --git a/externs/xol.js b/externs/xol.js index 2f75f9813b..eaaf01a57f 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,25 +1,4 @@ -/** - * @typedef {Object} control_OverviewMapOptions - * @property {boolean|undefined} collapsed Whether the control should start collapsed or not (expanded). - * Default to `true`. - * @property {string|Element|undefined} collapseLabel Text label to use for the expanded overviewmap button. Default is `«`. - * Instead of text, also an element (e.g. a `span` element) can be used. - * @property {boolean|undefined} collapsible Whether the control can be collapsed or not. Default to `true`. - * @property {string|Element|undefined} label Text label to use for the collapsed overviewmap button. Default is `»`. - * Instead of text, also an element (e.g. a `span` element) can be used. - * @property {Array.|ol.Collection.|undefined} layers Layers for the overview map. If not set, then all main map layers are used - * instead. - * @property {function(ol.MapEvent)|undefined} render Function called when the control should be re-rendered. This is called - * in a requestAnimationFrame callback. - * @property {Element|string|undefined} target Specify a target if you want the control to be rendered outside of the map's - * viewport. - * @property {string|undefined} tipLabel Text label to use for the button tip. Default is `Overview map` - * @property {ol.View|undefined} view Custom view for the overview map. If not provided, a default view with - * an EPSG:3857 projection will be used. - */ - - /** * @typedef {Object} control_ScaleLineOptions * @property {string|undefined} className CSS Class name. Default is `ol-scale-line`. diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index 274523bae1..382a394a6b 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -36,12 +36,38 @@ const MAX_RATIO = 0.75; const MIN_RATIO = 0.1; +/** + * @typedef {Object} Options + * @property {boolean|undefined} collapsed Whether the control should start collapsed + * or not (expanded). Default to `true`. + * @property {string|Element|undefined} collapseLabel Text label to use for the + * expanded overviewmap button. Default is `'«'`. Instead of text, also an element + * (e.g. a `span` element) can be used. + * @property {boolean|undefined} collapsible Whether the control can be collapsed + * or not. Default to `true`. + * @property {string|Element|undefined} label Text label to use for the collapsed + * overviewmap button. Default is `'»'`. Instead of text, also an element + * (e.g. a `span` element) can be used. + * @property {Array.|ol.Collection.|undefined} layers + * Layers for the overview map. If not set, then all main map layers are used + * instead. + * @property {function(ol.MapEvent)|undefined} render Function called when the control + * should be re-rendered. This is called in a `requestAnimationFrame` callback. + * @property {Element|string|undefined} target Specify a target if you want the control + * to be rendered outside of the map's viewport. + * @property {string|undefined} tipLabel Text label to use for the button tip. Default + * is `'Overview map'`. + * @property {ol.View|undefined} view Custom view for the overview map. If not provided, + * a default view with an EPSG:3857 projection will be used. + */ + + /** * Create a new control with a map acting as an overview map for an other * defined map. * @constructor * @extends {ol.control.Control} - * @param {olx.control.OverviewMapOptions=} opt_options OverviewMap options. + * @param {module:ol/control/OverviewMap~Options=} opt_options OverviewMap options. * @api */ const OverviewMap = function(opt_options) {