diff --git a/externs/olx.js b/externs/olx.js index 004c107a58..bbe90a7adc 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,57 +5,6 @@ var olx; -/* typedefs for object literals provided by applications */ - - -/** - * @typedef {{unique: (boolean|undefined)}} - */ -olx.CollectionOptions; - - -/** - * Disallow the same item from being added to the collection twice. Default is - * false. - * @type {boolean|undefined} - * @api - */ -olx.CollectionOptions.prototype.unique; - - -/** - * @typedef {{tracking: (boolean|undefined), - * trackingOptions: (GeolocationPositionOptions|undefined), - * projection: ol.ProjectionLike}} - */ -olx.GeolocationOptions; - - -/** - * Start Tracking. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.GeolocationOptions.prototype.tracking; - - -/** - * Tracking options. See - * {@link http://www.w3.org/TR/geolocation-API/#position_options_interface}. - * @type {GeolocationPositionOptions|undefined} - * @api - */ -olx.GeolocationOptions.prototype.trackingOptions; - - -/** - * The projection the position is reported in. - * @type {ol.ProjectionLike} - * @api - */ -olx.GeolocationOptions.prototype.projection; - - /** * Object literal with config options for the map logo. * @typedef {{href: (string), src: (string)}} @@ -79,362 +28,6 @@ olx.LogoOptions.prototype.href; olx.LogoOptions.prototype.src; -/** - * @typedef {{map: (ol.PluggableMap|undefined), - * maxLines: (number|undefined), - * strokeStyle: (ol.style.Stroke|undefined), - * targetSize: (number|undefined), - * showLabels: (boolean|undefined), - * lonLabelFormatter: (undefined|function(number):string), - * latLabelFormatter: (undefined|function(number):string), - * lonLabelPosition: (number|undefined), - * latLabelPosition: (number|undefined), - * lonLabelStyle: (ol.style.Text|undefined), - * latLabelStyle: (ol.style.Text|undefined)}} - */ -olx.GraticuleOptions; - - -/** - * Reference to an `ol.Map` object. - * @type {ol.PluggableMap|undefined} - * @api - */ -olx.GraticuleOptions.prototype.map; - - -/** - * The maximum number of meridians and parallels from the center of the - * map. The default value is 100, which means that at most 200 meridians - * and 200 parallels will be displayed. The default value is appropriate - * for conformal projections like Spherical Mercator. If you increase - * the value more lines will be drawn and the drawing performance will - * decrease. - * @type {number|undefined} - * @api - */ -olx.GraticuleOptions.prototype.maxLines; - - -/** - * The stroke style to use for drawing the graticule. If not provided, the - * lines will be drawn with `rgba(0,0,0,0.2)`, a not fully opaque black. - * - * @type {ol.style.Stroke|undefined} - * @api - */ -olx.GraticuleOptions.prototype.strokeStyle; - - -/** - * The target size of the graticule cells, in pixels. Default - * value is 100 pixels. - * @type {number|undefined} - * @api - */ -olx.GraticuleOptions.prototype.targetSize; - - -/** - * Render a label with the respective latitude/longitude for each graticule - * line. Default is false. - * - * @type {boolean|undefined} - * @api - */ -olx.GraticuleOptions.prototype.showLabels; - - -/** - * Label formatter for longitudes. This function is called with the longitude as - * argument, and should return a formatted string representing the longitude. - * By default, labels are formatted as degrees, minutes, seconds and hemisphere. - * - * @type {undefined|function(number):string} - * @api - */ -olx.GraticuleOptions.prototype.lonLabelFormatter; - - -/** - * Label formatter for latitudes. This function is called with the latitude as - * argument, and should return a formatted string representing the latitude. - * By default, labels are formatted as degrees, minutes, seconds and hemisphere. - * - * @type {undefined|function(number):string} - * @api - */ -olx.GraticuleOptions.prototype.latLabelFormatter; - - -/** - * Longitude label position in fractions (0..1) of view extent. 0 means at the - * bottom of the viewport, 1 means at the top. Default is 0. - * @type {number|undefined} - * @api - */ -olx.GraticuleOptions.prototype.lonLabelPosition; - - -/** - * Latitude label position in fractions (0..1) of view extent. 0 means at the - * left of the viewport, 1 means at the right. Default is 1. - * @type {number|undefined} - * @api - */ -olx.GraticuleOptions.prototype.latLabelPosition; - - -/** - * Longitude label text style. The default is - * ```js - * new ol.style.Text({ - * font: '12px Calibri,sans-serif', - * textBaseline: 'bottom', - * fill: new ol.style.Fill({ - * color: 'rgba(0,0,0,1)' - * }), - * stroke: new ol.style.Stroke({ - * color: 'rgba(255,255,255,1)', - * width: 3 - * }) - * }); - * ``` - * Note that the default's `textBaseline` configuration will not work well for - * `lonLabelPosition` configurations that position labels close to the top of - * the viewport. - * - * @type {ol.style.Text|undefined} - * @api - */ -olx.GraticuleOptions.prototype.lonLabelStyle; - - -/** - * Latitude label text style. The default is - * ```js - * new ol.style.Text({ - * font: '12px Calibri,sans-serif', - * textAlign: 'end', - * fill: new ol.style.Fill({ - * color: 'rgba(0,0,0,1)' - * }), - * stroke: new ol.style.Stroke({ - * color: 'rgba(255,255,255,1)', - * width: 3 - * }) - * }); - * ``` - * Note that the default's `textAlign` configuration will not work well for - * `latLabelPosition` configurations that position labels close to the left of - * the viewport. - * - * @type {ol.style.Text|undefined} - * @api - */ -olx.GraticuleOptions.prototype.latLabelStyle; - - -/** - * Object literal with config options for interactions. - * @typedef {{handleEvent: function(ol.MapBrowserEvent):boolean}} - */ -olx.interaction.InteractionOptions; - - -/** - * Method called by the map to notify the interaction that a browser event was - * dispatched to the map. If the function returns a falsy value, - * propagation of the event to other interactions in the map's interactions - * chain will be prevented (this includes functions with no explicit return). See - * {@link https://developer.mozilla.org/en-US/docs/Glossary/Falsy} - * @type {function(ol.MapBrowserEvent):boolean} - * @api - */ -olx.interaction.InteractionOptions.prototype.handleEvent; - - -/** - * Object literal with config options for the map. - * @typedef {{controls: (ol.Collection.|Array.|undefined), - * pixelRatio: (number|undefined), - * interactions: (ol.Collection.|Array.|undefined), - * keyboardEventTarget: (Element|Document|string|undefined), - * layers: (Array.|ol.Collection.|undefined), - * loadTilesWhileAnimating: (boolean|undefined), - * loadTilesWhileInteracting: (boolean|undefined), - * logo: (boolean|string|olx.LogoOptions|Element|undefined), - * moveTolerance: (number|undefined), - * overlays: (ol.Collection.|Array.|undefined), - * renderer: (ol.renderer.Type|Array.|undefined), - * target: (Element|string|undefined), - * view: (ol.View|undefined)}} - */ -olx.MapOptions; - - -/** - * Controls initially added to the map. If not specified, - * {@link ol.control.defaults ol.control.defaults()} is used. - * @type {ol.Collection.|Array.|undefined} - * @api - */ -olx.MapOptions.prototype.controls; - - -/** - * The ratio between physical pixels and device-independent pixels (dips) on the - * device. If `undefined` then it gets set by using `window.devicePixelRatio`. - * @type {number|undefined} - * @api - */ -olx.MapOptions.prototype.pixelRatio; - - -/** - * Interactions that are initially added to the map. If not specified, - * {@link ol.interaction.defaults ol.interaction.defaults()} is used. - * @type {ol.Collection.|Array.|undefined} - * @api - */ -olx.MapOptions.prototype.interactions; - - -/** - * The element to listen to keyboard events on. This determines when the - * `KeyboardPan` and `KeyboardZoom` interactions trigger. For example, if this - * option is set to `document` the keyboard interactions will always trigger. If - * this option is not specified, the element the library listens to keyboard - * events on is the map target (i.e. the user-provided div for the map). If this - * is not `document` the target element needs to be focused for key events to be - * emitted, requiring that the target element has a `tabindex` attribute. - * @type {Element|Document|string|undefined} - * @api - */ -olx.MapOptions.prototype.keyboardEventTarget; - - -/** - * Layers. If this is not defined, a map with no layers will be rendered. Note - * that layers are rendered in the order supplied, so if you want, for example, - * a vector layer to appear on top of a tile layer, it must come after the tile - * layer. - * @type {Array.|ol.Collection.|undefined} - * @api - */ -olx.MapOptions.prototype.layers; - - -/** - * When set to true, tiles will be loaded during animations. This may improve - * the user experience, but can also make animations stutter on devices with - * slow memory. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.MapOptions.prototype.loadTilesWhileAnimating; - - -/** - * When set to true, tiles will be loaded while interacting with the map. This - * may improve the user experience, but can also make map panning and zooming - * choppy on devices with slow memory. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.MapOptions.prototype.loadTilesWhileInteracting; - - -/** - * The map logo. A logo to be displayed on the map at all times. If a string is - * provided, it will be set as the image source of the logo. If an object is - * provided, the `src` property should be the URL for an image and the `href` - * property should be a URL for creating a link. If an element is provided, - * the element will be used. To disable the map logo, set the option to - * `false`. By default, the OpenLayers logo is shown. - * @type {boolean|string|olx.LogoOptions|Element|undefined} - * @api - */ -olx.MapOptions.prototype.logo; - - -/** - * The minimum distance in pixels the cursor must move to be detected - * as a map move event instead of a click. Increasing this value can make it - * easier to click on the map. - * Default is `1`. - * @type {number|undefined} - * @api - */ -olx.MapOptions.prototype.moveTolerance; - - -/** - * Overlays initially added to the map. By default, no overlays are added. - * @type {ol.Collection.|Array.|undefined} - * @api - */ -olx.MapOptions.prototype.overlays; - - -/** - * Renderer. By default, Canvas and WebGL renderers are tested for support - * in that order, and the first supported used. Specify a - * {@link ol.renderer.Type} here to use a specific renderer. - * Note that the Canvas renderer fully supports vector data, but WebGL can only - * render Point geometries. - * @type {ol.renderer.Type|Array.|undefined} - * @api - */ -olx.MapOptions.prototype.renderer; - - -/** - * The container for the map, either the element itself or the `id` of the - * element. If not specified at construction time, {@link ol.Map#setTarget} - * must be called for the map to be rendered. - * @type {Element|string|undefined} - * @api - */ -olx.MapOptions.prototype.target; - - -/** - * The map's view. No layer sources will be fetched unless this is specified at - * construction time or through {@link ol.Map#setView}. - * @type {ol.View|undefined} - * @api - */ -olx.MapOptions.prototype.view; - - -/** - * Object literal with options for the {@link ol.Sphere.getLength} or - * {@link ol.Sphere.getArea} functions. - * @typedef {{projection: (ol.ProjectionLike|undefined), - * radius: (number|undefined)}} - */ -olx.SphereMetricOptions; - - -/** - * Projection of the geometry. By default, the geometry is assumed to be in - * EPSG:3857 (Web Mercator). - * @type {(ol.ProjectionLike|undefined)} - * @api - */ -olx.SphereMetricOptions.prototype.projection; - - -/** - * Sphere radius. By default, the radius of the earth is used (Clarke 1866 - * Authalic Sphere). - * @type {(number|undefined)} - * @api - */ -olx.SphereMetricOptions.prototype.radius; - - /** * Options for tile constructors. * @typedef {{transition: (number|undefined)}} diff --git a/src/ol/Collection.js b/src/ol/Collection.js index 9203fbb2f9..35598754a0 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -1,17 +1,19 @@ /** * @module ol/Collection */ -/** - * An implementation of Google Maps' MVCArray. - * @see https://developers.google.com/maps/documentation/javascript/reference - */ - import {inherits} from './index.js'; import _ol_AssertionError_ from './AssertionError.js'; import _ol_CollectionEventType_ from './CollectionEventType.js'; import _ol_Object_ from './Object.js'; import Event from './events/Event.js'; + +/** + * @typedef {{unique: (boolean|undefined)}} + */ +export var CollectionOptions; + + /** * @classdesc * An expanded version of standard JS Array, adding convenience methods for @@ -24,7 +26,9 @@ import Event from './events/Event.js'; * @extends {ol.Object} * @fires ol.Collection.Event * @param {Array.=} opt_array Array. - * @param {olx.CollectionOptions=} opt_options Collection options. + * @param {CollectionOptions=} opt_options Collection options. + * @param {boolean|undefined} opt_options.unique Disallow the same item from + * being added to the collection twice. Default is false. * @template T * @api */ diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index 1d507461f0..b3a793273e 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -1,8 +1,6 @@ /** * @module ol/Geolocation */ -// FIXME handle geolocation not supported - import {inherits} from './index.js'; import _ol_GeolocationProperty_ from './GeolocationProperty.js'; import _ol_Object_ from './Object.js'; @@ -15,6 +13,15 @@ import _ol_math_ from './math.js'; import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js'; import _ol_proj_EPSG4326_ from './proj/EPSG4326.js'; + +/** + * @typedef {{tracking: (boolean|undefined), + * trackingOptions: (GeolocationPositionOptions|undefined), + * projection: ol.ProjectionLike}} + */ +export var GeolocationOptions; + + /** * @classdesc * Helper class for providing HTML5 Geolocation capabilities. @@ -38,7 +45,14 @@ import _ol_proj_EPSG4326_ from './proj/EPSG4326.js'; * @fires error * @constructor * @extends {ol.Object} - * @param {olx.GeolocationOptions=} opt_options Options. + * @param {GeolocationOptions=} opt_options Options. + * @param {boolean|undefined} opt_options.tracking Start Tracking. Default is + * `false`. + * @param {GeolocationPositionOptions|undefined} opt_options.trackingOptions + * Tracking options. See + * {@link http://www.w3.org/TR/geolocation-API/#position_options_interface}. + * @param {ol.ProjectionLike} opt_options.projection The projection the position + * is reported in. * @api */ var _ol_Geolocation_ = function(opt_options) { diff --git a/src/ol/Graticule.js b/src/ol/Graticule.js index f900928c0e..524a21d13a 100644 --- a/src/ol/Graticule.js +++ b/src/ol/Graticule.js @@ -14,10 +14,90 @@ import _ol_style_Fill_ from './style/Fill.js'; import _ol_style_Stroke_ from './style/Stroke.js'; import _ol_style_Text_ from './style/Text.js'; + +/** + * @typedef {{map: (ol.PluggableMap|undefined), + * maxLines: (number|undefined), + * strokeStyle: (ol.style.Stroke|undefined), + * targetSize: (number|undefined), + * showLabels: (boolean|undefined), + * lonLabelFormatter: (undefined|function(number):string), + * latLabelFormatter: (undefined|function(number):string), + * lonLabelPosition: (number|undefined), + * latLabelPosition: (number|undefined), + * lonLabelStyle: (ol.style.Text|undefined), + * latLabelStyle: (ol.style.Text|undefined)}} + */ +export var GraticuleOptions; + + /** * Render a grid for a coordinate system on a map. * @constructor - * @param {olx.GraticuleOptions=} opt_options Options. + * @param {GraticuleOptions=} opt_options Options. + * @param {ol.PluggableMap|undefined} opt_options.map Reference to an `ol.Map` + * object. + * @param {number|undefined} opt_options.maxLines The maximum number of + * meridians and parallels from the center of the + * map. The default value is 100, which means that at most 200 meridians + * and 200 parallels will be displayed. The default value is appropriate + * for conformal projections like Spherical Mercator. If you increase + * the value more lines will be drawn and the drawing performance will + * decrease. + * @param {ol.style.Stroke|undefined} opt_options.strokeStyle The stroke style + * to use for drawing the graticule. If not provided, the + * lines will be drawn with `rgba(0,0,0,0.2)`, a not fully opaque black. + * @param {number|undefined} opt_options.targetSize The target size of the + * graticule cells, in pixels. Default value is 100 pixels. + * @param {boolean|undefined} opt_options.showLabels Render a label with the + * respective latitude/longitude for each graticule line. Default is false. + * @param {undefined|function(number):string} opt_options.lonLabelFormatter + * Label formatter for longitudes. This function is called with the + * longitude as argument, and should return a formatted string representing + * the longitude. By default, labels are formatted as degrees, minutes, + * seconds and hemisphere. + * @param {number|undefined} opt_options.lonLabelPosition Longitude label + * position in fractions (0..1) of view extent. 0 means at the bottom of the + * viewport, 1 means at the top. Default is 0. + * @param {number|undefined} opt_options.latLabelPosition Latitude label + * position in fractions (0..1) of view extent. 0 means at the left of the + * viewport, 1 means at the right. Default is 1. + * @param {ol.style.Text|undefined} options.lonLabelStyle Longitude label text + * style. The default is + * ```js + * new ol.style.Text({ + * font: '12px Calibri,sans-serif', + * textBaseline: 'bottom', + * fill: new ol.style.Fill({ + * color: 'rgba(0,0,0,1)' + * }), + * stroke: new ol.style.Stroke({ + * color: 'rgba(255,255,255,1)', + * width: 3 + * }) + * }); + * ``` + * Note that the default's `textBaseline` configuration will not work well + * for `lonLabelPosition` configurations that position labels close to the + * top of the viewport. + * @param {ol.style.Text|undefined} opt_options.latLabelStyle Latitude label + * text style. The default is + * ```js + * new ol.style.Text({ + * font: '12px Calibri,sans-serif', + * textAlign: 'end', + * fill: new ol.style.Fill({ + * color: 'rgba(0,0,0,1)' + * }), + * stroke: new ol.style.Stroke({ + * color: 'rgba(255,255,255,1)', + * width: 3 + * }) + * }); + * ``` + * Note that the default's `textAlign` configuration will not work well for + * `latLabelPosition` configurations that position labels close to the left + * of the viewport. * @api */ var _ol_Graticule_ = function(opt_options) { diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 7e0ccf8988..6b480bf94f 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -31,10 +31,87 @@ import _ol_size_ from './size.js'; import _ol_structs_PriorityQueue_ from './structs/PriorityQueue.js'; import _ol_transform_ from './transform.js'; + +/** + * Object literal with config options for the map. + * @typedef {{controls: (ol.Collection.|Array.|undefined), + * pixelRatio: (number|undefined), + * interactions: (ol.Collection.|Array.|undefined), + * keyboardEventTarget: (Element|Document|string|undefined), + * layers: (Array.|ol.Collection.|undefined), + * loadTilesWhileAnimating: (boolean|undefined), + * loadTilesWhileInteracting: (boolean|undefined), + * logo: (boolean|string|olx.LogoOptions|Element|undefined), + * moveTolerance: (number|undefined), + * overlays: (ol.Collection.|Array.|undefined), + * renderer: (ol.renderer.Type|Array.|undefined), + * target: (Element|string|undefined), + * view: (ol.View|undefined)}} + */ +export var MapOptions; + + /** * @constructor * @extends {ol.Object} - * @param {olx.MapOptions} options Map options. + * @param {MapOptions} options Map options. + * @param {ol.Collection.|Array.|undefined} options.controls + * Controls initially added to the map. If not specified, + * {@link ol.control.defaults ol.control.defaults()} is used. + * @param {number|undefined} options.pixelRatio The ratio between physical + * pixels and device-independent pixels (dips) on the device. If + * `undefined` then it gets set by using `window.devicePixelRatio`. + * @param {ol.Collection.|Array.|undefined} options.interactions + * Interactions that are initially added to the map. If not specified, + * {@link ol.interaction.defaults ol.interaction.defaults()} is used. + * @param {Element|Document|string|undefined} options.keyboardEventTarget The + * element to listen to keyboard events on. This determines when the + * `KeyboardPan` and `KeyboardZoom` interactions trigger. For example, if + * this option is set to `document` the keyboard interactions will always + * trigger. If this option is not specified, the element the library listens + * to keyboard events on is the map target (i.e. the user-provided div for + * the map). If this is not `document` the target element needs to be + * focused for key events to be emitted, requiring that the target element + * has a `tabindex` attribute. + * @param {Array.|ol.Collection.|undefined} options.layers + * Layers. If this is not defined, a map with no layers will be rendered. + * Note that layers are rendered in the order supplied, so if you want, for + * example, a vector layer to appear on top of a tile layer, it must come + * after the tile layer. + * @param {boolean|undefined} options.loadTilesWhileAnimating When set to true, + * tiles will be loaded during animations. This may improve the user + * experience, but can also make animations stutter on devices with slow + * memory. Default is `false`. + * @param {boolean|undefined} options.loadTilesWhileInteracting When set to + * true, tiles will be loaded while interacting with the map. This may + * improve the user experience, but can also make map panning and zooming + * choppy on devices with slow memory. Default is `false`. + * @param {boolean|string|olx.LogoOptions|Element|undefined} options.logo The + * map logo. A logo to be displayed on the map at all times. If a string is + * provided, it will be set as the image source of the logo. If an object is + * provided, the `src` property should be the URL for an image and the + * `href` property should be a URL for creating a link. If an element is + * provided, the element will be used. To disable the map logo, set the + * option to `false`. By default, the OpenLayers logo is shown. + * @param {number|undefined} options.moveTolerance The minimum distance in + * pixels the cursor must move to be detected as a map move event instead + * of a click. Increasing this value can make it easier to click on the map. + * Default is `1`. + * @param {ol.Collection.|Array.|undefined} options.overlays + * Overlays initially added to the map. By default, no overlays are added. + * @param {ol.renderer.Type|Array.|undefined} options.renderer + * Renderer. By default, Canvas and WebGL renderers are tested for support + * in that order, and the first supported used. Specify a + * {@link ol.renderer.Type} here to use a specific renderer. Note that the + * Canvas renderer fully supports vector data, but WebGL can only render + * Point geometries. + * @param {Element|string|undefined} options.target The container for the map, + * either the element itself or the `id` of the element. If not specified at + * construction time, {@link ol.Map#setTarget} must be called for the map to + * be rendered. + * @param {ol.View|undefined} options.view The map's view. No layer sources + * will be fetched unless this is specified at construction time or through + * {@link ol.Map#setView}. * @fires ol.MapBrowserEvent * @fires ol.MapEvent * @fires ol.render.Event#postcompose @@ -1351,7 +1428,7 @@ _ol_PluggableMap_.LOGO_URL = 'data:image/png;base64,' + /** - * @param {olx.MapOptions} options Map options. + * @param {MapOptions} options Map options. * @return {ol.MapOptionsInternal} Internal map options. */ _ol_PluggableMap_.createOptionsInternal = function(options) { diff --git a/src/ol/Sphere.js b/src/ol/Sphere.js index bc4974b88c..7a598f5cac 100644 --- a/src/ol/Sphere.js +++ b/src/ol/Sphere.js @@ -1,16 +1,26 @@ /** * @module ol/Sphere */ + /** * @license * Latitude/longitude spherical geodesy formulae taken from * http://www.movable-type.co.uk/scripts/latlong.html * Licensed under CC-BY-3.0. */ - import _ol_math_ from './math.js'; import GeometryType from './geom/GeometryType.js'; + +/** + * Object literal with options for the {@link ol.Sphere.getLength} or + * {@link ol.Sphere.getArea} functions. + * @typedef {{projection: (ol.ProjectionLike|undefined), + * radius: (number|undefined)}} + */ +export var SphereMetricOptions; + + /** * @classdesc * Class to create objects that can be used with {@link @@ -106,9 +116,14 @@ _ol_Sphere_.DEFAULT_RADIUS = 6371008.8; * the sum of all rings. For points, the length is zero. For multi-part * geometries, the length is the sum of the length of each part. * @param {ol.geom.Geometry} geometry A geometry. - * @param {olx.SphereMetricOptions=} opt_options Options for the length + * @param {SphereMetricOptions=} opt_options Options for the length * calculation. By default, geometries are assumed to be in 'EPSG:3857'. * You can change this by providing a `projection` option. + * @param {(ol.ProjectionLike|undefined)} opt_options.projection Projection of + * the geometry. By default, the geometry is assumed to be in EPSG:3857 + * (Web Mercator). + * @param {(number|undefined)} opt_options.radius Sphere radius. By default, + * the radius of the earth is used (Clarke 1866 Authalic Sphere). * @return {number} The spherical length (in meters). * @api */ diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index 6094e05b9e..6a9bd864df 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -1,14 +1,20 @@ /** * @module ol/interaction/Interaction */ -// FIXME factor out key precondition (shift et. al) - import {inherits} from '../index.js'; import _ol_Object_ from '../Object.js'; import {easeOut, linear} from '../easing.js'; import _ol_interaction_Property_ from '../interaction/Property.js'; import _ol_math_ from '../math.js'; + +/** + * Object literal with config options for interactions. + * @typedef {{handleEvent: function(ol.MapBrowserEvent):boolean}} + */ +export var InteractionOptions; + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -22,7 +28,13 @@ import _ol_math_ from '../math.js'; * vectors and so are visible on the screen. * * @constructor - * @param {olx.interaction.InteractionOptions} options Options. + * @param {InteractionOptions} options Options. + * @param {function(ol.MapBrowserEvent):boolean} options.handleEvent Method + * called by the map to notify the interaction that a browser event was + * dispatched to the map. If the function returns a falsy value, + * propagation of the event to other interactions in the map's interactions + * chain will be prevented (this includes functions with no explicit + * return). * @extends {ol.Object} * @api */ diff --git a/src/ol/source/Source.js b/src/ol/source/Source.js index 3b81f70f4a..233cc49df7 100644 --- a/src/ol/source/Source.js +++ b/src/ol/source/Source.js @@ -6,6 +6,14 @@ import _ol_Object_ from '../Object.js'; import {get as getProjection} from '../proj.js'; import _ol_source_State_ from '../source/State.js'; + +/** + * Object literal with config options for the map logo. + * @typedef {{href: (string), src: (string)}} + */ +export var LogoOptions; + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -38,7 +46,7 @@ var _ol_source_Source_ = function(options) { /** * @private - * @type {string|olx.LogoOptions|undefined} + * @type {string|LogoOptions|undefined} */ this.logo_ = options.logo; @@ -108,7 +116,7 @@ _ol_source_Source_.prototype.getAttributions = function() { /** * Get the logo of the source. - * @return {string|olx.LogoOptions|undefined} Logo. + * @return {string|LogoOptions|undefined} Logo. * @api */ _ol_source_Source_.prototype.getLogo = function() { @@ -175,7 +183,7 @@ _ol_source_Source_.prototype.setAttributions = function(attributions) { /** * Set the logo of the source. - * @param {string|olx.LogoOptions|undefined} logo Logo. + * @param {string|LogoOptions|undefined} logo Logo. */ _ol_source_Source_.prototype.setLogo = function(logo) { this.logo_ = logo;