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

Polygon case #7

Closed moovida closed 3 years ago

moovida commented 3 years ago

Hi, I finally have been able to test this plugin properly (thanks a ton for it). While it works nicely for lines, I incurred in an issue for polygons. Let's see if I am able to explain it.

If I load the polygon using the right coordinates (i.e. first and last equal), I get this: image which has the following problem, if editing the startpoint: image

I am thinking about a possible workaround but nothing clean comes to my mind. I think the best would be to remove the last point during editing and then add it back once editing finished (it is anyways the same as the first).

The problem is that while the drag markers should have one less, the editing Polyline shown below the markers, needs to be closed, else one edge is missing.

And since the two share the same list of coordinates in order to be able to "move" consistently during dragging... I have no idea what would be best to do here. Do you have any idea? :-)

ibrierley commented 3 years ago

Can you confirm if you have the latest version (was updated about 27 days ago)...I thought there was a fix for that, so just wanted to make sure it's not something already fixed.

If you're on the latest one, could you add a minimal example case, and I'll take a peek when I get chance.

moovida commented 3 years ago

Yes, I have the latest version. I see you added addClosePathMarker in the last commits.

I will try to create an example, thanks.

moovida commented 3 years ago

@ibrierley , just opened PR #8 to see the issue. Thanks.

ibrierley commented 3 years ago

What are you setting addClosePathMarker to when creating your PolyEditor instance ? I think you have that missing (think that's my fault as I should include it in test example, it is in the readme) ?

eg addClosePathMarker: false, // set to true if polygon, false if polyline,

moovida commented 3 years ago

No, I got it right from either your code or the readme. I am setting: addClosePathMarker: true, when I am handling a polygon.

ibrierley commented 3 years ago

Just looking at your code (I'm not able to test just atm), you are using a polyline, but addClosePathMarker: true... I suspect you want this to be false, as you're actually using a polyline in the code, not polygon ?

moovida commented 3 years ago

OMG! it was too obvious. I though this would edit only polylines, but in case of polygons I am allowed to use polygon! Sorry sorry for all the noise. I just tested and it works perfect.

ibrierley commented 3 years ago

No problem :)