Skip to content

Commit 7f3e92b

Browse files
TobikblomFalke-Design
authored andcommitted
Allow removal of holes in polygons while maintaining the minimum vertex count of the geometry
1 parent 346205f commit 7f3e92b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/js/Edit/L.PM.Edit.Line.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,11 @@ Edit.Line = Edit.extend({
473473
let markerArr =
474474
indexPath.length > 1 ? get(this._markers, parentPath) : this._markers;
475475

476-
// prevent removal of the layer if the vertex count is below minimum
477-
if (!this.options.removeLayerBelowMinVertexCount) {
476+
// define whether marker is part of hole
477+
const isHole = parentPath[parentPath.length - 1] > 0;
478+
479+
// prevent removal of the layer if the vertex count is below minimum when not a hole
480+
if (!this.options.removeLayerBelowMinVertexCount && !isHole) {
478481
// if on a line only 2 vertices left or on a polygon 3 vertices left, don't allow to delete
479482
if (
480483
coordsRing.length <= 2 ||

0 commit comments

Comments
 (0)