Merge pull request #6842 from cs09g/cs09g-patch-1

add condition to check if active
This commit is contained in:
Andreas Hocevar
2017-05-24 13:20:08 +02:00
committed by GitHub
+6
View File
@@ -65,6 +65,8 @@ ol.inherits(ol.interaction.DragAndDrop, ol.interaction.Interaction);
* @private * @private
*/ */
ol.interaction.DragAndDrop.handleDrop_ = function(event) { ol.interaction.DragAndDrop.handleDrop_ = function(event) {
var active = this.getActive();
if (active) {
var files = event.dataTransfer.files; var files = event.dataTransfer.files;
var i, ii, file; var i, ii, file;
for (i = 0, ii = files.length; i < ii; ++i) { for (i = 0, ii = files.length; i < ii; ++i) {
@@ -74,6 +76,7 @@ ol.interaction.DragAndDrop.handleDrop_ = function(event) {
this.handleResult_.bind(this, file)); this.handleResult_.bind(this, file));
reader.readAsText(file); reader.readAsText(file);
} }
}
}; };
@@ -82,9 +85,12 @@ ol.interaction.DragAndDrop.handleDrop_ = function(event) {
* @private * @private
*/ */
ol.interaction.DragAndDrop.handleStop_ = function(event) { ol.interaction.DragAndDrop.handleStop_ = function(event) {
var active = this.getActive();
if (active) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
event.dataTransfer.dropEffect = 'copy'; event.dataTransfer.dropEffect = 'copy';
}
}; };