I am playing around with the options for Leaflet-Draw and have came up wit a little annoyance. Using a colorpicker I can set the color for every new polyline I draw by invoking options.draw.polyline.shapeOptions.color with draw:drawstart like this:
map.on('draw:drawstart', function() {
drawControl.options.draw.polyline.shapeOptions.color = theInput.value;
});
The problem emerges when when changing color and drawing my first polyline - the line segment still have the old color (better explained with a picture):
After finishing the firts polyline it turns to the right color and all new polylines segments have the right color but that first drawn polyline annoys me. Any idea how to solve this? There are no line segment style options in the documentation. And how do I style the dotted line?