From 16a466e002c44e476772aea350ede100aa8ce1aa Mon Sep 17 00:00:00 2001 From: Florian Bischof Date: Sat, 23 Nov 2024 14:40:33 +0100 Subject: [PATCH] Remove temp layers from the map --- src/js/Edit/L.PM.Edit.CircleMarker.js | 9 +++++---- src/js/Edit/L.PM.Edit.Line.js | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/js/Edit/L.PM.Edit.CircleMarker.js b/src/js/Edit/L.PM.Edit.CircleMarker.js index 24a94074..fdb323bf 100644 --- a/src/js/Edit/L.PM.Edit.CircleMarker.js +++ b/src/js/Edit/L.PM.Edit.CircleMarker.js @@ -82,11 +82,11 @@ Edit.CircleMarker = Edit.extend({ if (this.layerDragEnabled()) { this.disableLayerDrag(); } - + if (this._helperLayers) { + this._helperLayers.clearLayers(); + this._helperLayers.removeFrom(this._map); + } if (this.options[this._editableOption]) { - if (this._helperLayers) { - this._helperLayers.clearLayers(); - } this._map.off('move', this._syncMarkers, this); this._outerMarker.off('drag', this._handleOuterMarkerSnapping, this); } else { @@ -158,6 +158,7 @@ Edit.CircleMarker = Edit.extend({ // cleanup old ones first if (this._helperLayers) { + this._helperLayers.removeFrom(map); this._helperLayers.clearLayers(); } diff --git a/src/js/Edit/L.PM.Edit.Line.js b/src/js/Edit/L.PM.Edit.Line.js index ae72ed2e..c549f05e 100644 --- a/src/js/Edit/L.PM.Edit.Line.js +++ b/src/js/Edit/L.PM.Edit.Line.js @@ -136,6 +136,7 @@ Edit.Line = Edit.extend({ // cleanup old ones first if (this._markerGroup) { + this._markerGroup.removeFrom(map); this._markerGroup.clearLayers(); }