Make DragAndDropEvent private to module

This commit is contained in:
Tim Schaub
2018-02-19 13:58:28 -07:00
parent 1be61fdb09
commit 8c20bf5d7d

View File

@@ -18,20 +18,62 @@ import {get as getProjection} from '../proj.js';
const DragAndDropEventType = {
/**
* Triggered when features are added
* @event ol.interaction.DragAndDrop.Event#addfeatures
* @event ol.interaction.DragAndDropEvent#addfeatures
* @api
*/
ADD_FEATURES: 'addfeatures'
};
/**
* @classdesc
* Events emitted by {@link ol.interaction.DragAndDrop} instances are instances
* of this type.
*
* @constructor
* @extends {ol.events.Event}
* @implements {oli.interaction.DragAndDropEvent}
* @param {ol.interaction.DragAndDropEventType} type Type.
* @param {File} file File.
* @param {Array.<ol.Feature>=} opt_features Features.
* @param {ol.proj.Projection=} opt_projection Projection.
*/
const DragAndDropEvent = function(type, file, opt_features, opt_projection) {
Event.call(this, type);
/**
* The features parsed from dropped data.
* @type {Array.<ol.Feature>|undefined}
* @api
*/
this.features = opt_features;
/**
* The dropped file.
* @type {File}
* @api
*/
this.file = file;
/**
* The feature projection.
* @type {ol.proj.Projection|undefined}
* @api
*/
this.projection = opt_projection;
};
inherits(DragAndDropEvent, Event);
/**
* @classdesc
* Handles input of vector data by drag and drop.
*
* @constructor
* @extends {ol.interaction.Interaction}
* @fires ol.interaction.DragAndDrop.Event
* @fires ol.interaction.DragAndDropEvent
* @param {olx.interaction.DragAndDropOptions=} opt_options Options.
* @api
*/
@@ -146,7 +188,7 @@ DragAndDrop.prototype.handleResult_ = function(file, event) {
this.source_.addFeatures(features);
}
this.dispatchEvent(
new DragAndDrop.Event(
new DragAndDropEvent(
DragAndDropEventType.ADD_FEATURES, file,
features, projection));
};
@@ -225,45 +267,4 @@ DragAndDrop.prototype.unregisterListeners_ = function() {
};
/**
* @classdesc
* Events emitted by {@link ol.interaction.DragAndDrop} instances are instances
* of this type.
*
* @constructor
* @extends {ol.events.Event}
* @implements {oli.interaction.DragAndDropEvent}
* @param {ol.interaction.DragAndDropEventType} type Type.
* @param {File} file File.
* @param {Array.<ol.Feature>=} opt_features Features.
* @param {ol.proj.Projection=} opt_projection Projection.
*/
DragAndDrop.Event = function(type, file, opt_features, opt_projection) {
Event.call(this, type);
/**
* The features parsed from dropped data.
* @type {Array.<ol.Feature>|undefined}
* @api
*/
this.features = opt_features;
/**
* The dropped file.
* @type {File}
* @api
*/
this.file = file;
/**
* The feature projection.
* @type {ol.proj.Projection|undefined}
* @api
*/
this.projection = opt_projection;
};
inherits(DragAndDrop.Event, Event);
export default DragAndDrop;