How can I clear a vector layer before drawstart in openlayers 3?

المشرف العام

Administrator
طاقم الإدارة
I have a vector layer in OL3 which I want to auto clear when drawing a feature (which means there is always max 1 feature in the layer).

Problem is that when I listen to drawstart (ol.interaction.draw) or to featureadd (ol.layer.vector) they are fired after feature is added and thus I can't clear the layer without them be deleted.

how can I workaround this ?



أكثر...
 
أعلى