Leaflet / Leaflet.Editable

Make geometries editable in Leaflet.
http://leaflet.github.io/Leaflet.Editable/doc/api.html
553 stars 198 forks source link

Rectangle setBounds breaks refreshVertexMarkers #204

Open DenofTranquility opened 3 years ago

DenofTranquility commented 3 years ago

Hi

I am trying to update a rectangle on vertex drag and when using setBounds it returns the error: TypeError: latlngs[i].__vertex is undefined

I have tried passing in the bounds as new L.latLngBounds, as new L.latLng() and also as an array of all 4 corners. I can't seem to get it to work, It could be that I'm missing something, any help would be appreciated Thanks

egormkn commented 11 months ago

I encountered the same error trying to use Leaflet.Editable with react-leaflet. Current implementation stores references to editing markers inside of LatLng objects and any manual changes to the vector layer will override them.

The only workaround I have found so far is to call disableEdit() before and enableEdit() after changing bounds. This does not allow changing bounds in real time and only reliably works on dragend and editable:vertex:dragend events.