Make DragAndDropEvent private to module
This commit is contained in:
@@ -18,20 +18,62 @@ import {get as getProjection} from '../proj.js';
|
|||||||
const DragAndDropEventType = {
|
const DragAndDropEventType = {
|
||||||
/**
|
/**
|
||||||
* Triggered when features are added
|
* Triggered when features are added
|
||||||
* @event ol.interaction.DragAndDrop.Event#addfeatures
|
* @event ol.interaction.DragAndDropEvent#addfeatures
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ADD_FEATURES: 'addfeatures'
|
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
|
* @classdesc
|
||||||
* 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 {ol.interaction.Interaction}
|
||||||
* @fires ol.interaction.DragAndDrop.Event
|
* @fires ol.interaction.DragAndDropEvent
|
||||||
* @param {olx.interaction.DragAndDropOptions=} opt_options Options.
|
* @param {olx.interaction.DragAndDropOptions=} opt_options Options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -146,7 +188,7 @@ DragAndDrop.prototype.handleResult_ = function(file, event) {
|
|||||||
this.source_.addFeatures(features);
|
this.source_.addFeatures(features);
|
||||||
}
|
}
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new DragAndDrop.Event(
|
new DragAndDropEvent(
|
||||||
DragAndDropEventType.ADD_FEATURES, file,
|
DragAndDropEventType.ADD_FEATURES, file,
|
||||||
features, projection));
|
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;
|
export default DragAndDrop;
|
||||||
|
|||||||
Reference in New Issue
Block a user