diff --git a/README.md b/README.md index b07b0ec..bc26e36 100644 --- a/README.md +++ b/README.md @@ -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 ); ``` diff --git a/lib/src/poly_editor.dart b/lib/src/poly_editor.dart index 1eaab18..4dbbdd1 100644 --- a/lib/src/poly_editor.dart +++ b/lib/src/poly_editor.dart @@ -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), @@ -45,7 +49,11 @@ class PolyEditor { List edit() { List 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],