Closed ingkiller closed 3 years ago
You can add a flag to the cutted layer:
// listen to changes on the cutted layer
e.layer.on('pm:cut', function(x) {
console.log('cut', x.originalLayer)
x.originalLayer.cutted = true;
});
// listen to changes on the new layer
e.layer.on('pm:edit', function(x) {
console.log('edit', x.layer.cutted)
});
Thank you very much, just what I needed, I had tried something similar only in layer not in originalLayer, thank you very much. Saludos
I have recently started using this fantastic tool (leaflet-geoman). I have noticed that after the cut event an edit event is also fired (as the doc refers to). The situation is the following, I have implemented a logic that after editing / moving some layer I make a call to the backend to update the new change (so far everything correctly),but when I cut a layer in the pm: cut event I get layer and originalLayer, send the new layer data, when doing a pm: cut it also triggers a pm: edit. How can you avoid this behavior or know that pm: edit was called by a pm: cut?
Saludos