Leaflet/Leaflet.Editable

Moving a circle through JS doesn't move the controls

DOFandersolsen opened this issue · 1 comments

I have a map section where the user can place a circle and resize the radius to indicate an area of the map.

When the user single-clicks outside the map, I want the circle to move so the center is where the mouse click happened.

This works, but the white boxes for the resize-controls are left behind.

Code:

//The click is outside the bounds, so if the circle exists, we move it to that center
    if (circle) {
      circle.setLatLng(coordinates);
    } else {
      circle = L.circle(coordinates, { radius: radius });
      circle.addTo(map);
      circle.enableEdit();
    } 

It gives me this result however:
skaermbillede 2018-09-17 kl 17 21 27

I know I can fix it by removing the circle, adding it again at the new position with the same radius, but I thought this is an unintended effect

A slightly better option than removing and adding the circle again is to call disableEdit() and then enableEdit(). Calling reset() didn't move the resize handle for me.