I'd like to update a list after each feature has been drawn to a map.
When I use drawend
to catch the finishing of a drawing, the feature being drawn is not yet added to the vector source at that moment.
So
var draw = new ol.interaction.Draw({
source: source,
type: 'Point'
});
draw.on('drawend', function () {
console.log(source.getFeatures().length)
});
map.addInteraction(draw);
Will output 0 when the first point has been added.
How can I catch the state of the map when the drawing is finished and the feature has been added to the vector source? Thus I'm looking for a state when source.getFeatures().length would be 1 on an empty map.