Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions
+44 -42
View File
@@ -1,15 +1,15 @@
/**
* @module ol/interaction/DragAndDrop
*/
// FIXME should handle all geo-referenced data, not just vector data
goog.provide('ol.interaction.DragAndDrop');
goog.require('ol');
goog.require('ol.functions');
goog.require('ol.events');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol.interaction.Interaction');
goog.require('ol.proj');
import _ol_ from '../index.js';
import _ol_functions_ from '../functions.js';
import _ol_events_ from '../events.js';
import _ol_events_Event_ from '../events/Event.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import _ol_proj_ from '../proj.js';
/**
* @classdesc
@@ -21,12 +21,12 @@ goog.require('ol.proj');
* @param {olx.interaction.DragAndDropOptions=} opt_options Options.
* @api
*/
ol.interaction.DragAndDrop = function(opt_options) {
var _ol_interaction_DragAndDrop_ = function(opt_options) {
var options = opt_options ? opt_options : {};
ol.interaction.Interaction.call(this, {
handleEvent: ol.interaction.DragAndDrop.handleEvent
_ol_interaction_Interaction_.call(this, {
handleEvent: _ol_interaction_DragAndDrop_.handleEvent
});
/**
@@ -41,7 +41,7 @@ ol.interaction.DragAndDrop = function(opt_options) {
* @type {ol.proj.Projection}
*/
this.projection_ = options.projection ?
ol.proj.get(options.projection) : null;
_ol_proj_.get(options.projection) : null;
/**
* @private
@@ -62,7 +62,8 @@ ol.interaction.DragAndDrop = function(opt_options) {
this.target = options.target ? options.target : null;
};
ol.inherits(ol.interaction.DragAndDrop, ol.interaction.Interaction);
_ol_.inherits(_ol_interaction_DragAndDrop_, _ol_interaction_Interaction_);
/**
@@ -70,13 +71,13 @@ ol.inherits(ol.interaction.DragAndDrop, ol.interaction.Interaction);
* @this {ol.interaction.DragAndDrop}
* @private
*/
ol.interaction.DragAndDrop.handleDrop_ = function(event) {
_ol_interaction_DragAndDrop_.handleDrop_ = function(event) {
var files = event.dataTransfer.files;
var i, ii, file;
for (i = 0, ii = files.length; i < ii; ++i) {
file = files.item(i);
var reader = new FileReader();
reader.addEventListener(ol.events.EventType.LOAD,
reader.addEventListener(_ol_events_EventType_.LOAD,
this.handleResult_.bind(this, file));
reader.readAsText(file);
}
@@ -87,7 +88,7 @@ ol.interaction.DragAndDrop.handleDrop_ = function(event) {
* @param {Event} event Event.
* @private
*/
ol.interaction.DragAndDrop.handleStop_ = function(event) {
_ol_interaction_DragAndDrop_.handleStop_ = function(event) {
event.stopPropagation();
event.preventDefault();
event.dataTransfer.dropEffect = 'copy';
@@ -99,7 +100,7 @@ ol.interaction.DragAndDrop.handleStop_ = function(event) {
* @param {Event} event Load event.
* @private
*/
ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) {
_ol_interaction_DragAndDrop_.prototype.handleResult_ = function(file, event) {
var result = event.target.result;
var map = this.getMap();
var projection = this.projection_;
@@ -133,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 _ol_interaction_DragAndDrop_.Event(
_ol_interaction_DragAndDrop_.EventType_.ADD_FEATURES, file,
features, projection));
};
@@ -147,25 +148,25 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) {
* @this {ol.interaction.DragAndDrop}
* @api
*/
ol.interaction.DragAndDrop.handleEvent = ol.functions.TRUE;
_ol_interaction_DragAndDrop_.handleEvent = _ol_functions_.TRUE;
/**
* @private
*/
ol.interaction.DragAndDrop.prototype.registerListeners_ = function() {
_ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() {
var map = this.getMap();
if (map) {
var dropArea = this.target ? this.target : map.getViewport();
this.dropListenKeys_ = [
ol.events.listen(dropArea, ol.events.EventType.DROP,
ol.interaction.DragAndDrop.handleDrop_, this),
ol.events.listen(dropArea, ol.events.EventType.DRAGENTER,
ol.interaction.DragAndDrop.handleStop_, this),
ol.events.listen(dropArea, ol.events.EventType.DRAGOVER,
ol.interaction.DragAndDrop.handleStop_, this),
ol.events.listen(dropArea, ol.events.EventType.DROP,
ol.interaction.DragAndDrop.handleStop_, this)
_ol_events_.listen(dropArea, _ol_events_EventType_.DROP,
_ol_interaction_DragAndDrop_.handleDrop_, this),
_ol_events_.listen(dropArea, _ol_events_EventType_.DRAGENTER,
_ol_interaction_DragAndDrop_.handleStop_, this),
_ol_events_.listen(dropArea, _ol_events_EventType_.DRAGOVER,
_ol_interaction_DragAndDrop_.handleStop_, this),
_ol_events_.listen(dropArea, _ol_events_EventType_.DROP,
_ol_interaction_DragAndDrop_.handleStop_, this)
];
}
};
@@ -174,8 +175,8 @@ ol.interaction.DragAndDrop.prototype.registerListeners_ = function() {
/**
* @inheritDoc
*/
ol.interaction.DragAndDrop.prototype.setActive = function(active) {
ol.interaction.Interaction.prototype.setActive.call(this, active);
_ol_interaction_DragAndDrop_.prototype.setActive = function(active) {
_ol_interaction_Interaction_.prototype.setActive.call(this, active);
if (active) {
this.registerListeners_();
} else {
@@ -187,9 +188,9 @@ ol.interaction.DragAndDrop.prototype.setActive = function(active) {
/**
* @inheritDoc
*/
ol.interaction.DragAndDrop.prototype.setMap = function(map) {
_ol_interaction_DragAndDrop_.prototype.setMap = function(map) {
this.unregisterListeners_();
ol.interaction.Interaction.prototype.setMap.call(this, map);
_ol_interaction_Interaction_.prototype.setMap.call(this, map);
if (this.getActive()) {
this.registerListeners_();
}
@@ -203,7 +204,7 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
* @private
* @return {Array.<ol.Feature>} Features.
*/
ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text, options) {
_ol_interaction_DragAndDrop_.prototype.tryReadFeatures_ = function(format, text, options) {
try {
return format.readFeatures(text, options);
} catch (e) {
@@ -215,9 +216,9 @@ ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text, o
/**
* @private
*/
ol.interaction.DragAndDrop.prototype.unregisterListeners_ = function() {
_ol_interaction_DragAndDrop_.prototype.unregisterListeners_ = function() {
if (this.dropListenKeys_) {
this.dropListenKeys_.forEach(ol.events.unlistenByKey);
this.dropListenKeys_.forEach(_ol_events_.unlistenByKey);
this.dropListenKeys_ = null;
}
};
@@ -227,7 +228,7 @@ ol.interaction.DragAndDrop.prototype.unregisterListeners_ = function() {
* @enum {string}
* @private
*/
ol.interaction.DragAndDrop.EventType_ = {
_ol_interaction_DragAndDrop_.EventType_ = {
/**
* Triggered when features are added
* @event ol.interaction.DragAndDrop.Event#addfeatures
@@ -250,9 +251,9 @@ ol.interaction.DragAndDrop.EventType_ = {
* @param {Array.<ol.Feature>=} opt_features Features.
* @param {ol.proj.Projection=} opt_projection Projection.
*/
ol.interaction.DragAndDrop.Event = function(type, file, opt_features, opt_projection) {
_ol_interaction_DragAndDrop_.Event = function(type, file, opt_features, opt_projection) {
ol.events.Event.call(this, type);
_ol_events_Event_.call(this, type);
/**
* The features parsed from dropped data.
@@ -276,4 +277,5 @@ ol.interaction.DragAndDrop.Event = function(type, file, opt_features, opt_projec
this.projection = opt_projection;
};
ol.inherits(ol.interaction.DragAndDrop.Event, ol.events.Event);
_ol_.inherits(_ol_interaction_DragAndDrop_.Event, _ol_events_Event_);
export default _ol_interaction_DragAndDrop_;