ibrierley / flutter_map_line_editor

A basic line/poly editor that works with flutter_map and dragmarkers.
MIT License
44 stars 25 forks source link

add polygon test #8

Closed moovida closed 3 years ago

moovida commented 3 years ago

In this PR I just added a main class to test an existing polygon.

The polyline is created a linearring, i.e. first and last coordinate are the same.

  static const d = 1;
  var testPolyline = new Polyline(color: Colors.deepOrange, points: [
    LatLng(45.5231 - d, -122.676 - d),
    LatLng(45.5231 + d, -122.676 - d),
    LatLng(45.5231 + d, -122.676 + d),
    LatLng(45.5231 - d, -122.676 + d),
    LatLng(45.5231 - d, -122.676 - d),
  ]);

This results in this: image if I try to drag the lower left handle: image and if I then drag the remaining: image

On a second try (pulling the same handle from one more top corner (so not really reproducible), I get this: image the issue here is that there are two handlers even if the node represents a single point of the polygon.

If I try to leave away the closing polygon point using:

  var testPolyline = new Polyline(color: Colors.deepOrange, points: [
    LatLng(45.5231 - d, -122.676 - d),
    LatLng(45.5231 + d, -122.676 - d),
    LatLng(45.5231 + d, -122.676 + d),
    LatLng(45.5231 - d, -122.676 + d),
  ]);

then I get this: image which behaves properly: image but misses the closing edge.

The polyline is created on a different Polyline object. Wouldn't it be possible to have also the polyline rendered by the polyEditor? If there is something I can do to help, just let me know.

moovida commented 3 years ago

Closing as invalid