diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 971f736329..44fdd05d59 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -6,7 +6,7 @@ import _ol_format_IGC_ from '../src/ol/format/IGC.js'; import _ol_format_KML_ from '../src/ol/format/KML.js'; import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; -import _ol_interaction_DragAndDrop_ from '../src/ol/interaction/DragAndDrop.js'; +import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; @@ -83,7 +83,7 @@ var styleFunction = function(feature, resolution) { } }; -var dragAndDropInteraction = new _ol_interaction_DragAndDrop_({ +var dragAndDropInteraction = new DragAndDrop({ formatConstructors: [ _ol_format_GPX_, _ol_format_GeoJSON_, diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 2fdb6fe3f9..222efea03b 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -6,7 +6,7 @@ import _ol_format_IGC_ from '../src/ol/format/IGC.js'; import _ol_format_KML_ from '../src/ol/format/KML.js'; import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; -import _ol_interaction_DragAndDrop_ from '../src/ol/interaction/DragAndDrop.js'; +import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; @@ -83,7 +83,7 @@ var styleFunction = function(feature, resolution) { } }; -var dragAndDropInteraction = new _ol_interaction_DragAndDrop_({ +var dragAndDropInteraction = new DragAndDrop({ formatConstructors: [ _ol_format_GPX_, _ol_format_GeoJSON_, diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index e6f8caf98e..a9a6d8f210 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -21,12 +21,12 @@ import {get as getProjection} from '../proj.js'; * @param {olx.interaction.DragAndDropOptions=} opt_options Options. * @api */ -var _ol_interaction_DragAndDrop_ = function(opt_options) { +var DragAndDrop = function(opt_options) { var options = opt_options ? opt_options : {}; Interaction.call(this, { - handleEvent: _ol_interaction_DragAndDrop_.handleEvent + handleEvent: DragAndDrop.handleEvent }); /** @@ -63,7 +63,7 @@ var _ol_interaction_DragAndDrop_ = function(opt_options) { }; -inherits(_ol_interaction_DragAndDrop_, Interaction); +inherits(DragAndDrop, Interaction); /** @@ -71,7 +71,7 @@ inherits(_ol_interaction_DragAndDrop_, Interaction); * @this {ol.interaction.DragAndDrop} * @private */ -_ol_interaction_DragAndDrop_.handleDrop_ = function(event) { +DragAndDrop.handleDrop_ = function(event) { var files = event.dataTransfer.files; var i, ii, file; for (i = 0, ii = files.length; i < ii; ++i) { @@ -88,7 +88,7 @@ _ol_interaction_DragAndDrop_.handleDrop_ = function(event) { * @param {Event} event Event. * @private */ -_ol_interaction_DragAndDrop_.handleStop_ = function(event) { +DragAndDrop.handleStop_ = function(event) { event.stopPropagation(); event.preventDefault(); event.dataTransfer.dropEffect = 'copy'; @@ -100,7 +100,7 @@ _ol_interaction_DragAndDrop_.handleStop_ = function(event) { * @param {Event} event Load event. * @private */ -_ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) { +DragAndDrop.prototype.handleResult_ = function(file, event) { var result = event.target.result; var map = this.getMap(); var projection = this.projection_; @@ -134,8 +134,8 @@ _ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) { this.source_.addFeatures(features); } this.dispatchEvent( - new _ol_interaction_DragAndDrop_.Event( - _ol_interaction_DragAndDrop_.EventType_.ADD_FEATURES, file, + new DragAndDrop.Event( + DragAndDrop.EventType_.ADD_FEATURES, file, features, projection)); }; @@ -148,25 +148,25 @@ _ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) { * @this {ol.interaction.DragAndDrop} * @api */ -_ol_interaction_DragAndDrop_.handleEvent = TRUE; +DragAndDrop.handleEvent = TRUE; /** * @private */ -_ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() { +DragAndDrop.prototype.registerListeners_ = function() { var map = this.getMap(); if (map) { var dropArea = this.target ? this.target : map.getViewport(); this.dropListenKeys_ = [ _ol_events_.listen(dropArea, EventType.DROP, - _ol_interaction_DragAndDrop_.handleDrop_, this), + DragAndDrop.handleDrop_, this), _ol_events_.listen(dropArea, EventType.DRAGENTER, - _ol_interaction_DragAndDrop_.handleStop_, this), + DragAndDrop.handleStop_, this), _ol_events_.listen(dropArea, EventType.DRAGOVER, - _ol_interaction_DragAndDrop_.handleStop_, this), + DragAndDrop.handleStop_, this), _ol_events_.listen(dropArea, EventType.DROP, - _ol_interaction_DragAndDrop_.handleStop_, this) + DragAndDrop.handleStop_, this) ]; } }; @@ -175,7 +175,7 @@ _ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() { /** * @inheritDoc */ -_ol_interaction_DragAndDrop_.prototype.setActive = function(active) { +DragAndDrop.prototype.setActive = function(active) { Interaction.prototype.setActive.call(this, active); if (active) { this.registerListeners_(); @@ -188,7 +188,7 @@ _ol_interaction_DragAndDrop_.prototype.setActive = function(active) { /** * @inheritDoc */ -_ol_interaction_DragAndDrop_.prototype.setMap = function(map) { +DragAndDrop.prototype.setMap = function(map) { this.unregisterListeners_(); Interaction.prototype.setMap.call(this, map); if (this.getActive()) { @@ -204,7 +204,7 @@ _ol_interaction_DragAndDrop_.prototype.setMap = function(map) { * @private * @return {Array.