Editor in LDraw for LRectangle does not work

When a LRectangle is added to a LFeatureGroup to be edited it gets the LPolygon editor; that is, it has handles at every corner and at the midpoint of each side. The LRectangle editor has handles only at the corners and a move handle in the center of the rectangle. Unlike with LPolygon, when the corner handles of the LRectangle editor are dragged it remains a rectangle by also moving the adjacent corners to keep them lined up vertically and horizontally. This can be seen in the Leaflet.Draw demo here: https://github.com/Leaflet/Leaflet.draw (click on “Check out the demo”).

This would not be a big issue if a LPolygon was returned in the FeatureModifiedListener, but a LRectangle is returned that surrounds the shape that was edited. For example, in the code snippet below, you can move the handles of the rectangle until it no longer looks like a rectangle. When you click ‘Save’ the System.out prints out “org.vaadin.addon.leaflet.LRectangle” and the vector drawn in regionLayer is a rectangle that is a bounding box for all points in the polygon, not the polygon that was in the editor at the time ‘Save’ was clicked.

Is there a way to get the LRectangle editor working with v-leafler-draw? Thanks -GS

// ======== Code Snippet ======== //
public void testLRectangleEdit() {
final LMap lMap = new LMap();
final LLayerGroup regionLayer = new LLayerGroup();
lMap.addLayer(regionLayer);

final LDraw lDraw = new LDraw();
final LFeatureGroup lFeatureGroup = new LFeatureGroup();
lDraw.setEditableFeatureGroup(lFeatureGroup);
lMap.addLayer(lFeatureGroup);
lMap.addControl(lDraw);

lFeatureGroup.addComponent(new LRectangle(new Bounds(new Point(60.447, 22.294), new Point(60.457, 22.304))));
lDraw.addFeatureModifiedListener(new LDraw.FeatureModifiedListener() {
    @Override
    public void featureModified(LDraw.FeatureModifiedEvent event) {
        System.out.println(event.getModifiedFeature().getClass().getName());
        regionLayer.addComponent(event.getModifiedFeature());
        lMap.removeLayer(lFeatureGroup);
        lMap.removeControl(lDraw);
    }
});

}

<This was also added to mstahv/v-leaflet on GitHub>

Hi,

I answered to the project page, this is probably already fixed in github.

cheers,
matti