8

I want to modify style of the method select . I'm able to change the style of this method but i'm not able to duplicate the white border of blue stroke.

Someone is able to style vector with a stroke and put a border to the stroke?

See this example, for understand what i'm talking about: http://openlayers.org/en/v3.4.0/examples/select-features.html

FatAl
  • 859
  • 1
  • 6
  • 20

1 Answers1

14

The trick is that you have two styles. With the first style you are drawing a white line, with the second style a thinner blue line on top:

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
    })
  })
];
tsauerwein
  • 5,841
  • 3
  • 36
  • 49