Add styleFunction option to ol.interaction.DragAndDrop
This commit is contained in:
@@ -293,6 +293,8 @@
|
|||||||
* features will be added to this layer's source. If neither `source` nor
|
* 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` are defined then the dropped features will be added as a new
|
||||||
* layer.
|
* layer.
|
||||||
|
* @property {ol.feature.StyleFunction|undefined} styleFunction Style function.
|
||||||
|
* This is used to configure any new layers created.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ ol.interaction.DragAndDrop = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.layer_ = goog.isDef(options.layer) ? options.layer : null;
|
this.layer_ = goog.isDef(options.layer) ? options.layer : null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.feature.StyleFunction|undefined}
|
||||||
|
*/
|
||||||
|
this.styleFunction_ = options.styleFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {goog.events.FileDropHandler}
|
* @type {goog.events.FileDropHandler}
|
||||||
@@ -149,6 +155,7 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(result) {
|
|||||||
}
|
}
|
||||||
if (goog.isNull(this.layer_)) {
|
if (goog.isNull(this.layer_)) {
|
||||||
map.getLayers().push(new ol.layer.Vector({
|
map.getLayers().push(new ol.layer.Vector({
|
||||||
|
styleFunction: this.styleFunction_,
|
||||||
source: source
|
source: source
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user