From 05bf3e8b48129354a510e51237e1ecf635d29cad Mon Sep 17 00:00:00 2001 From: James Lyne Date: Wed, 23 Dec 2020 18:02:10 +0000 Subject: [PATCH] Prevent removed markers reapparing after toggling layer visibility --- src/components/map/vector/Areas.vue | 2 +- src/components/map/vector/Circles.vue | 2 +- src/components/map/vector/Lines.vue | 2 +- src/components/map/vector/Markers.vue | 2 +- src/leaflet/layer/DynmapLayerGroup.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/map/vector/Areas.vue b/src/components/map/vector/Areas.vue index 718de5c..b98ad39 100644 --- a/src/components/map/vector/Areas.vue +++ b/src/components/map/vector/Areas.vue @@ -67,7 +67,7 @@ export default defineComponent({ return; } - area.remove(); + props.layerGroup.removeLayer(area); layers.delete(id); }, diff --git a/src/components/map/vector/Circles.vue b/src/components/map/vector/Circles.vue index 01c2900..7a864b5 100644 --- a/src/components/map/vector/Circles.vue +++ b/src/components/map/vector/Circles.vue @@ -67,7 +67,7 @@ export default defineComponent({ return; } - circle.remove(); + props.layerGroup.removeLayer(circle); layers.delete(id); }, diff --git a/src/components/map/vector/Lines.vue b/src/components/map/vector/Lines.vue index f6b82b0..289bda5 100644 --- a/src/components/map/vector/Lines.vue +++ b/src/components/map/vector/Lines.vue @@ -66,7 +66,7 @@ export default defineComponent({ return; } - line.remove(); + props.layerGroup.removeLayer(line); layers.delete(id); }, diff --git a/src/components/map/vector/Markers.vue b/src/components/map/vector/Markers.vue index 43e1306..2619e11 100644 --- a/src/components/map/vector/Markers.vue +++ b/src/components/map/vector/Markers.vue @@ -65,7 +65,7 @@ export default defineComponent({ return; } - marker.remove(); + props.layerGroup.removeLayer(marker); layers.delete(id); }, diff --git a/src/leaflet/layer/DynmapLayerGroup.ts b/src/leaflet/layer/DynmapLayerGroup.ts index 13a503d..48fdb3c 100644 --- a/src/leaflet/layer/DynmapLayerGroup.ts +++ b/src/leaflet/layer/DynmapLayerGroup.ts @@ -103,7 +103,7 @@ export default class DynmapLayerGroup extends LayerGroup { removeLayer(layer: Layer): this { this._zoomLimitedLayers.delete(layer); - return super.addLayer(layer); + return super.removeLayer(layer); } update(options: DynmapLayerGroupOptions) {