Add styleFunction option to ol.interaction.DragAndDrop

This commit is contained in:
Tom Payne
2014-01-16 19:14:46 +01:00
parent 7fc274c750
commit 7d5b1265b7
2 changed files with 9 additions and 0 deletions

View File

@@ -293,6 +293,8 @@
* features will be added to this layer's source. If neither `source` nor
* `layer` are defined then the dropped features will be added as a new
* layer.
* @property {ol.feature.StyleFunction|undefined} styleFunction Style function.
* This is used to configure any new layers created.
*/
/**

View File

@@ -52,6 +52,12 @@ ol.interaction.DragAndDrop = function(opt_options) {
*/
this.layer_ = goog.isDef(options.layer) ? options.layer : null;
/**
* @private
* @type {ol.feature.StyleFunction|undefined}
*/
this.styleFunction_ = options.styleFunction;
/**
* @private
* @type {goog.events.FileDropHandler}
@@ -149,6 +155,7 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(result) {
}
if (goog.isNull(this.layer_)) {
map.getLayers().push(new ol.layer.Vector({
styleFunction: this.styleFunction_,
source: source
}));
}