No olx and ol types for ol/interaction/DragAndDrop

This commit is contained in:
ahocevar
2018-03-14 12:33:58 +01:00
parent cfb8cd3d62
commit 7c7e002ee4
3 changed files with 34 additions and 80 deletions
-45
View File
@@ -5,51 +5,6 @@
let olx; let olx;
/**
* @typedef {{formatConstructors: (Array.<function(new: ol.format.Feature)>|undefined),
* source: (ol.source.Vector|undefined),
* projection: ol.ProjectionLike,
* target: (Element|undefined)}}
*/
olx.interaction.DragAndDropOptions;
/**
* Format constructors.
* @type {Array.<function(new: ol.format.Feature)>|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), * @typedef {{className: (string|undefined),
* condition: (ol.EventsConditionType|undefined), * condition: (ol.EventsConditionType|undefined),
-14
View File
@@ -1,17 +1,4 @@
/**
* @typedef {Object} interaction_DragAndDropOptions
* @property {Array.<function(new: ol.format.Feature)>|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 * @typedef {Object} interaction_DragBoxOptions
* @property {string|undefined} className CSS class name for styling the box. The default is `ol-dragbox`. * @property {string|undefined} className CSS class name for styling the box. The default is `ol-dragbox`.
@@ -1460,4 +1447,3 @@
* `WEBGL_MAX_TEXTURE_SIZE` or 2048 if WebGL is not supported. * `WEBGL_MAX_TEXTURE_SIZE` or 2048 if WebGL is not supported.
* @property {number|undefined} space The space in pixels between images (default: 1). * @property {number|undefined} space The space in pixels between images (default: 1).
*/ */
+20 -7
View File
@@ -12,13 +12,26 @@ import Interaction from '../interaction/Interaction.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
/**
* @typedef {Object} Options
* @property {Array.<function(new: ol.format.Feature)>|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} * @enum {string}
*/ */
const DragAndDropEventType = { const DragAndDropEventType = {
/** /**
* Triggered when features are added * Triggered when features are added
* @event ol.interaction.DragAndDropEvent#addfeatures * @event module:ol/interaction/DragAndDrop~DragAndDropEvent#addfeatures
* @api * @api
*/ */
ADD_FEATURES: 'addfeatures' ADD_FEATURES: 'addfeatures'
@@ -27,13 +40,13 @@ const DragAndDropEventType = {
/** /**
* @classdesc * @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. * of this type.
* *
* @constructor * @constructor
* @extends {ol.events.Event} * @extends {ol.events.Event}
* @implements {oli.interaction.DragAndDropEvent} * @implements {oli.interaction.DragAndDropEvent}
* @param {ol.interaction.DragAndDropEventType} type Type. * @param {module:ol/interaction/DragAndDrop~DragAndDropEventType} type Type.
* @param {File} file File. * @param {File} file File.
* @param {Array.<module:ol/Feature~Feature>=} opt_features Features. * @param {Array.<module:ol/Feature~Feature>=} opt_features Features.
* @param {module:ol/proj/Projection~Projection=} opt_projection Projection. * @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. * Handles input of vector data by drag and drop.
* *
* @constructor * @constructor
* @extends {ol.interaction.Interaction} * @extends {module:ol/interaction/Interaction~Interaction}
* @fires ol.interaction.DragAndDropEvent * @fires module:ol/interaction/DragAndDrop~DragAndDropEvent
* @param {olx.interaction.DragAndDropOptions=} opt_options Options. * @param {module:ol/interaction/DragAndDrop~Options=} opt_options Options.
* @api * @api
*/ */
const DragAndDrop = function(opt_options) { const DragAndDrop = function(opt_options) {
@@ -124,7 +137,7 @@ inherits(DragAndDrop, Interaction);
/** /**
* @param {Event} event Event. * @param {Event} event Event.
* @this {ol.interaction.DragAndDrop} * @this {module:ol/interaction/DragAndDrop~DragAndDrop}
*/ */
function handleDrop(event) { function handleDrop(event) {
const files = event.dataTransfer.files; const files = event.dataTransfer.files;