Allow drag and drop interaction to be configured with a source
This commit is contained in:
1 parent
23405b80a2
commit
17b6088a79
3 files changed
+67
-1
No files matched your search
@@ -49,6 +49,12 @@ ol.interaction.DragAndDrop = function(opt_options) {
|
||||
*/
|
||||
this.dropListenKeys_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.source.Vector}
|
||||
*/
|
||||
this.source_ = options.source || null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Element}
|
||||
@@ -122,6 +128,10 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this.source_) {
|
||||
this.source_.clear();
|
||||
this.source_.addFeatures(features);
|
||||
}
|
||||
this.dispatchEvent(
|
||||
new ol.interaction.DragAndDrop.Event(
|
||||
ol.interaction.DragAndDrop.EventType_.ADD_FEATURES, file,
|
||||
|
||||
Reference in new issue
Block a user