From 8c20bf5d7da72ce957dc7181798aa27de5ea5b2d Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 19 Feb 2018 13:58:28 -0700 Subject: [PATCH] Make DragAndDropEvent private to module --- src/ol/interaction/DragAndDrop.js | 89 ++++++++++++++++--------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index a7f4289134..e337181c52 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -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.=} 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.|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.=} 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.|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;