Add target property to drag&drop interaction

This commit is contained in:
tsauerwein
2016-02-19 16:03:35 +01:00
parent 6c7d6817bd
commit 1e8bbb0ae4
3 changed files with 33 additions and 2 deletions

View File

@@ -50,6 +50,12 @@ ol.interaction.DragAndDrop = function(opt_options) {
*/
this.dropListenKeys_ = null;
/**
* @private
* @type {Element}
*/
this.target = options.target ? options.target : null;
};
goog.inherits(ol.interaction.DragAndDrop, ol.interaction.Interaction);
@@ -141,7 +147,7 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
}
goog.base(this, 'setMap', map);
if (map) {
var dropArea = map.getViewport();
var dropArea = this.target ? this.target : map.getViewport();
this.dropListenKeys_ = [
ol.events.listen(dropArea, ol.events.EventType.DROP,
ol.interaction.DragAndDrop.handleDrop_, this),