Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ var polyEditor = PolyEditor(
intermediateIcon: Icon(Icons.lens, size: 15, color: Colors.grey),
callbackRefresh: () => { this.setState(() {})},
addClosePathMarker: false, // set to true if polygon
addLineStartMarker: true, // set to false, to remove first marker of line
addLineEndMarker: true, // set to false, to remove last marker of line
);
```

Expand Down
10 changes: 9 additions & 1 deletion lib/src/poly_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ class PolyEditor {
final Size intermediateIconSize;
final void Function(LatLng? updatePoint)? callbackRefresh;
final bool addClosePathMarker;
final bool addLineStartMarker;
final bool addLineEndMarker;

PolyEditor({
required this.points,
required this.pointIcon,
this.intermediateIcon,
this.callbackRefresh,
this.addLineStartMarker = false,
this.addLineEndMarker = false,
this.addClosePathMarker = false,
this.pointIconSize = const Size(30, 30),
this.intermediateIconSize = const Size(30, 30),
Expand Down Expand Up @@ -45,7 +49,11 @@ class PolyEditor {
List<DragMarker> edit() {
List<DragMarker> dragMarkers = [];

for (var c = 0; c < points.length; c++) {
final startC = addLineStartMarker || addClosePathMarker ? 0 : 1;
final endC = addLineEndMarker || addClosePathMarker
? points.length
: points.length - 1;
for (var c = startC; c < endC; c++) {
final indexClosure = c;
dragMarkers.add(DragMarker(
point: points[c],
Expand Down