Closed vodnicearv closed 5 years ago
You can do this with regular leaflet. Something like this:
this.map.on('pm:create', e => {
this.map.eachLayer(layer, () => {
if(!e.target !== layer) {
layer.remove();
}
})
});
@codeofsumit Thank You!
My working code is:
this.map.eachLayer(layer => {
if (typeof layer._latlngs !== 'undefined' && layer._latlngs.length > 0 && e.layer._leaflet_id !== layer._leaflet_id) {
layer.remove()
}
})
Hello, need to remove all another polygons when user add a new polygon on map. Or limit count of polygons to 1. Can someone tell me how to do this?
I tried: this.map.pm.Draw.Polygon._removeLastVertex() but get an error: