webber
webber

Reputation: 69

How to reset MapBoxGl's line-dasharray property of a line layer?

I add a line layer in MapBoxGl with a property named line-dasharray, now I want to remove the effect of line-dasharray by map.setPaintProperty(layerId,'line-dasharray',[1,0]),but It still have little dash , what should I do ? And I don't want to make it by remove the layer and add it without line-dasharray.

Upvotes: 0

Views: 1104

Answers (1)

Scarysize
Scarysize

Reputation: 4281

As suggested in the comments above, the correct way to "reset" the line-dasharray property is this:

map.setPaintProperty(layerId, 'line-dasharray', null)

You can also use undefined instead of null, though an empty string will result in an error.

Upvotes: 3

Related Questions