我想修改方法选择框的样式。我可以改变这个方法的样式,但我无法复制蓝色描边的白色边框。
有人能够用描边方式为矢量图添加边框吗?
请看这个例子,以便理解我所说的: http://openlayers.org/en/v3.4.0/examples/select-features.html
有人能够用描边方式为矢量图添加边框吗?
请看这个例子,以便理解我所说的: http://openlayers.org/en/v3.4.0/examples/select-features.html
诀窍在于你有两种样式。第一种样式是画白线,第二种样式是在其上方画一条较细的蓝线:
var width = 3;
var styles = [
new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'white',
width: width + 2
})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: width
})
})
];