Allow drag and drop interaction to be configured with a source
This commit is contained in:
@@ -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