Make select interaction create its FeatureOverlay

You can now configure it with a `style` option.
This commit is contained in:
Antoine Abt
2014-02-21 11:59:43 +01:00
parent fe159aa7fa
commit 7cea6f3240
5 changed files with 15 additions and 12 deletions

View File

@@ -227,12 +227,15 @@ var overlayStyle = (function() {
};
})();
var select = new ol.interaction.Select({
style: overlayStyle
});
var overlay = new ol.FeatureOverlay({
features: select.getFeatures(),
style: overlayStyle
});
var modify = new ol.interaction.Modify({ featureOverlay: overlay });
var select = new ol.interaction.Select({ featureOverlay: overlay });
var map = new ol.Map({
interactions: ol.interaction.defaults().extend([select, modify]),

View File

@@ -31,11 +31,9 @@ var vector = new ol.layer.Vector({
});
var select = new ol.interaction.Select({
featureOverlay: new ol.FeatureOverlay({
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255,255,255,0.5)'
})
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255,255,255,0.5)'
})
})
});