I have learned a Draw object in Openlayers.
I try to draw the dotted line when user moves the mouse. When user clicks the last and prev lines should be replaced on straight line.
How does it work, should I use two different drawing ayers and switch between them?
Or I can retrieve a last line from draw object and redraw it on straight line?
I try to use this sample from official document:
https://openlayers.org/en/latest/examples/measure-style.html
There is a solution: measure-style
draw.on('drawend', function (e) {
e.feature.set('finished',true)
...
});
function styleFunction(feature, segments, drawType, tip) {
const stroke = style.getStroke()
if (feature.get('finished'))
stroke.setLineDash(null)
else
stroke.setLineDash([10,10])
...
}