From 7d5b1265b7dded621f35e6a0ada5daf1b29a9012 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Thu, 16 Jan 2014 19:14:46 +0100 Subject: [PATCH] Add styleFunction option to ol.interaction.DragAndDrop --- src/objectliterals.jsdoc | 2 ++ src/ol/interaction/draganddropinteraction.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 6669c8994b..2f78574651 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -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. */ /** diff --git a/src/ol/interaction/draganddropinteraction.js b/src/ol/interaction/draganddropinteraction.js index 0ed09d211f..329a3c5172 100644 --- a/src/ol/interaction/draganddropinteraction.js +++ b/src/ol/interaction/draganddropinteraction.js @@ -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 })); }