geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Events not firing #1430

Closed jpdalbertweil closed 10 months ago

jpdalbertweil commented 10 months ago

Hi, I'm using geoman.io to draw and edit geofences with react-leaflet. I create a polygon with multiple eventlistners, inculding "pm:cut". The problem: after the first cut has been made, no more events are fired.

Falke-Design commented 10 months ago

After each cut a new polygon is created. You need to apply all the listeners to the new layer again.

You get the new layer with the pm:cut event:

polygon.on('pm:cut', (e)=>{
   const newLayer = e.layer;
});

https://geoman.io/docs/modes/cut-mode

jpdalbertweil commented 10 months ago

Ah makes sense, didn't know that! Thank you for the quick response!