diff --git a/externs/olx.js b/externs/olx.js index 90bd5f5313..9b9b73ceee 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,51 +5,6 @@ let olx; -/** - * @typedef {{formatConstructors: (Array.|undefined), - * source: (ol.source.Vector|undefined), - * projection: ol.ProjectionLike, - * target: (Element|undefined)}} - */ -olx.interaction.DragAndDropOptions; - - -/** - * Format constructors. - * @type {Array.|undefined} - * @api - */ -olx.interaction.DragAndDropOptions.prototype.formatConstructors; - - -/** - * Optional vector source where features will be added. If a source is provided - * all existing features will be removed and new features will be added when - * they are dropped on the target. If you want to add features to a vector - * source without removing the existing features (append only), instead of - * providing the source option listen for the "addfeatures" event. - * @type {ol.source.Vector|undefined} - * @api - */ -olx.interaction.DragAndDropOptions.prototype.source; - - -/** - * Target projection. By default, the map's view's projection is used. - * @type {ol.ProjectionLike} - * @api - */ -olx.interaction.DragAndDropOptions.prototype.projection; - - -/** - * The element that is used as the drop target, default is the viewport element. - * @type {Element|undefined} - * @api - */ -olx.interaction.DragAndDropOptions.prototype.target; - - /** * @typedef {{className: (string|undefined), * condition: (ol.EventsConditionType|undefined), diff --git a/externs/xol.js b/externs/xol.js index e92673df2d..d3c261c4b2 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,17 +1,4 @@ -/** - * @typedef {Object} interaction_DragAndDropOptions - * @property {Array.|undefined} formatConstructors Format constructors. - * @property {ol.source.Vector|undefined} source Optional vector source where features will be added. If a source is provided - * all existing features will be removed and new features will be added when - * they are dropped on the target. If you want to add features to a vector - * source without removing the existing features (append only), instead of - * providing the source option listen for the "addfeatures" event. - * @property {ol.ProjectionLike} projection Target projection. By default, the map's view's projection is used. - * @property {Element|undefined} target The element that is used as the drop target, default is the viewport element. - */ - - /** * @typedef {Object} interaction_DragBoxOptions * @property {string|undefined} className CSS class name for styling the box. The default is `ol-dragbox`. @@ -452,7 +439,7 @@ * rendered as vectors and can stay upright on rotated views. * * `'vector'`: Vector tiles are rendered as vectors. Most accurate rendering * even during animations, but slower performance than the other options. - * + * * When `declutter` is set to `true`, `'hybrid'` will be used instead of * `'image'`. The default is `'hybrid'`. * @property {ol.RenderOrderFunction|undefined} renderOrder Render order. Function to be used when sorting features before rendering. By @@ -697,7 +684,7 @@ * access pixel data with the Canvas renderer. See * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} * for more detail. - * + * * Default is `anonymous`. * @property {number|undefined} maxZoom Max zoom. Default is `19`. * @property {boolean|undefined} opaque Whether the layer is opaque. Default is `true`. @@ -977,9 +964,9 @@ * @property {module:ol/Feature~FeatureLoader|undefined} loader The loader function used to load features, from a remote source for example. * If this is not set and `url` is set, the source will create and use an XHR * feature loader. - * + * * Example: - * + * * ```js * var vectorSource = new ol.source.Vector({ * format: new ol.format.GeoJSON(), @@ -1031,18 +1018,18 @@ * @property {boolean|undefined} useSpatialIndex By default, an RTree is used as spatial index. When features are removed and * added frequently, and the total number of features is low, setting this to * `false` may improve performance. - * + * * Note that * {@link ol.source.Vector#getFeaturesInExtent}, * {@link ol.source.Vector#getClosestFeatureToCoordinate} and * {@link ol.source.Vector#getExtent} cannot be used when `useSpatialIndex` is * set to `false`, and {@link ol.source.Vector#forEachFeatureInExtent} will loop * through all features. - * + * * When set to `false`, the features will be maintained in an * {@link ol.Collection}, which can be retrieved through * {@link ol.source.Vector#getFeaturesCollection}. - * + * * The default is `true`. * @property {boolean|undefined} wrapX Wrap the world horizontally. Default is `true`. For vector editing across the * -180° and 180° meridians to work properly, this should be set to `false`. The @@ -1306,9 +1293,9 @@ * Internet Explorer 10 and lower [do not support][mdn] the `setLineDash` * method on the `CanvasRenderingContext2D` and therefore this option will * have no visual effect in these browsers. - * + * * [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility - * + * * @property {number|undefined} lineDashOffset Line dash offset. Default is '0'. * @property {number|undefined} miterLimit Miter limit. Default is `10`. * @property {number|undefined} width Width. @@ -1362,7 +1349,7 @@ * @property {ol.StyleRenderFunction|undefined} renderer Custom renderer. When configured, `fill`, `stroke` and `image` will be * ignored, and the provided function will be called with each render frame for * each geometry. - * + * * @property {ol.style.Stroke|undefined} stroke Stroke style. * @property {ol.style.Text|undefined} text Text style. * @property {number|undefined} zIndex Z index. @@ -1445,10 +1432,10 @@ /** * @typedef {Object} ViewState - * @property {ol.Coordinate} center - * @property {module:ol/proj/Projection~Projection} projection - * @property {number} resolution - * @property {number} rotation + * @property {ol.Coordinate} center + * @property {module:ol/proj/Projection~Projection} projection + * @property {number} resolution + * @property {number} rotation * @property {number} zoom The current zoom level. */ @@ -1460,4 +1447,3 @@ * `WEBGL_MAX_TEXTURE_SIZE` or 2048 if WebGL is not supported. * @property {number|undefined} space The space in pixels between images (default: 1). */ - diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index 00750a29de..542dba32ba 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -12,13 +12,26 @@ import Interaction from '../interaction/Interaction.js'; import {get as getProjection} from '../proj.js'; +/** + * @typedef {Object} Options + * @property {Array.|undefined} formatConstructors Format constructors. + * @property {ol.source.Vector|undefined} source Optional vector source where features will be added. If a source is provided + * all existing features will be removed and new features will be added when + * they are dropped on the target. If you want to add features to a vector + * source without removing the existing features (append only), instead of + * providing the source option listen for the "addfeatures" event. + * @property {ol.ProjectionLike} projection Target projection. By default, the map's view's projection is used. + * @property {Element|undefined} target The element that is used as the drop target, default is the viewport element. + */ + + /** * @enum {string} */ const DragAndDropEventType = { /** * Triggered when features are added - * @event ol.interaction.DragAndDropEvent#addfeatures + * @event module:ol/interaction/DragAndDrop~DragAndDropEvent#addfeatures * @api */ ADD_FEATURES: 'addfeatures' @@ -27,13 +40,13 @@ const DragAndDropEventType = { /** * @classdesc - * Events emitted by {@link ol.interaction.DragAndDrop} instances are instances + * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances * of this type. * * @constructor * @extends {ol.events.Event} * @implements {oli.interaction.DragAndDropEvent} - * @param {ol.interaction.DragAndDropEventType} type Type. + * @param {module:ol/interaction/DragAndDrop~DragAndDropEventType} type Type. * @param {File} file File. * @param {Array.=} opt_features Features. * @param {module:ol/proj/Projection~Projection=} opt_projection Projection. @@ -72,9 +85,9 @@ inherits(DragAndDropEvent, Event); * Handles input of vector data by drag and drop. * * @constructor - * @extends {ol.interaction.Interaction} - * @fires ol.interaction.DragAndDropEvent - * @param {olx.interaction.DragAndDropOptions=} opt_options Options. + * @extends {module:ol/interaction/Interaction~Interaction} + * @fires module:ol/interaction/DragAndDrop~DragAndDropEvent + * @param {module:ol/interaction/DragAndDrop~Options=} opt_options Options. * @api */ const DragAndDrop = function(opt_options) { @@ -124,7 +137,7 @@ inherits(DragAndDrop, Interaction); /** * @param {Event} event Event. - * @this {ol.interaction.DragAndDrop} + * @this {module:ol/interaction/DragAndDrop~DragAndDrop} */ function handleDrop(event) { const files = event.dataTransfer.files;