In OpenLayers 3 is possible to change border color in a selection:
style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 2
})
});
But is possible to change only border-bottom ?
Something like:
style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 2,
border-bottom: 2px dotted #ff9900
})
});
For sure, thanks to the huge OL 3 resources available, you can use a second style to (simulate) a border bottom. Use a ol.style#GeometryFunction
. Inspired on this example.
http://jsfiddle.net/jonataswalker/k11bxma2/
A little bit different - http://jsfiddle.net/jonataswalker/n73gm0u9/
var style = [
new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: 'red',
width: 2
})
}),
new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 2
}),
geometry: function(feature) {
var geom = feature.getGeometry();
var extent = geom.getExtent();
var bottomLeft = ol.extent.getBottomLeft(extent);
var bottomRight = ol.extent.getBottomRight(extent);
// return a linestring with the second style
return new ol.geom.LineString([bottomLeft, bottomRight]);
}
})
];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With