FatAl
FatAl

Reputation: 899

OpenLayers 3 Stroke style

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

Upvotes: 8

Views: 9789

Answers (1)

tsauerwein
tsauerwein

Reputation: 6051

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
    })
  })
];

Upvotes: 14

Related Questions