Closed contibru closed 3 years ago
We can't detect if a layer is moved / changed programmatically, look for this into: #308
You can use the interal functions of Geoman to re-render the vertex markers:
layer.setLatLngs(coords);
// re-enable markers for the new coords
layer.pm._initMarkers();
With layer.pm._handleLayerStyle(true);
you can flash the layer red, if you want this.
Thank`s @Falke-Design , it works like a charm.
Is there a way to put this function external? I ask that because the vs code keep sayng that function doesn`t exist.
So, I used this to avoid the error for now.
// @ts-ignore
this.polygon.pm._initMarkers();
How would this work with a marker? I am allowing the user to either drag the marker or enter new coords which are used in a setLatLng command. When I try to drag the marker after updating the position with a setLatLng it snaps back to the position it was at before the setLatLng. I have tried using toggleEdit and disabling and enabling PM but it doesn't seem to help.
Hey everyone, I notice a problem when I change de coordinates of a polygon programmatically. The vertices remain in map. This code bellow doesn`t allow the user overllaping a polygon into another.
This is the code:
A gif showing the problem: