When a draw:editvertex event fires, how can I get information about the polygon which triggered it?
this.map.on('draw:editvertex', function (e) { debugger;
    var layers = e.layers;
    // I want to get current polygon latLng here
}.bind(this));
                This approach works for me (but doesn't feel like best practice) –
In my draw:editvertex handler I loop through the target._layers and look for the edited property:
map.on('draw:editvertex', function(e) {
    for (thisLayer in e.target._layers) {
        if (e.target._layers.hasOwnProperty(thisLayer)) {
            if (e.target._layers[thisLayer].hasOwnProperty("edited")) {
                console.log("we think we found the polygon?");
                console.log(e.target._layers[thisLayer]);
                // the updated Polygon array points are here:
                newPolyLatLngArray = e.target._layers[thisLayer].editing.latlngs[0];
            }
        }
    };
});
...like I said, this doesn't feel Awesome, but it is working for me so far.
There are not only layers in e, but also the target layer poly can be approached easily.
map.on('draw:editvertex', function (e) { 
  var poly = e.poly;
  var latlngs = poly.getLatLngs(); // here the polygon latlngs
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With