OpenLayers 3 Stroke style
Asked Answered
B

1

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

Boltzmann answered 30/4, 2015 at 5:2 Comment(0)
B
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
    })
  })
];
Brazen answered 30/4, 2015 at 7:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.