From fd26eee71325d2f5c25d15f7925308b27554694c Mon Sep 17 00:00:00 2001 From: James Lyne Date: Fri, 18 Dec 2020 18:02:01 +0000 Subject: [PATCH] Fix newly created markers/shapes not being added to the map --- src/components/map/vector/Areas.vue | 8 +++++++- src/components/map/vector/Circles.vue | 3 ++- src/components/map/vector/Lines.vue | 3 ++- src/components/map/vector/Markers.vue | 8 +++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/map/vector/Areas.vue b/src/components/map/vector/Areas.vue index fcb06da..a80b37f 100644 --- a/src/components/map/vector/Areas.vue +++ b/src/components/map/vector/Areas.vue @@ -80,7 +80,13 @@ export default defineComponent({ if(update.removed) { deleteArea(update.id); } else { - layers.set(update.id, updateArea(layers.get(update.id), update.payload as DynmapArea, converter)); + const layer = updateArea(layers.get(update.id), update.payload as DynmapArea, converter) + + if(!layers.has(update.id)) { + props.layerGroup.addLayer(layer); + } + + layers.set(update.id, layer); } } diff --git a/src/components/map/vector/Circles.vue b/src/components/map/vector/Circles.vue index f13ebbc..657fc06 100644 --- a/src/components/map/vector/Circles.vue +++ b/src/components/map/vector/Circles.vue @@ -83,9 +83,10 @@ export default defineComponent({ const layer = updateCircle(layers.get(update.id), update.payload as DynmapCircle, converter) if(!layers.has(update.id)) { - layers.set(update.id, layer); props.layerGroup.addLayer(layer); } + + layers.set(update.id, layer); } } diff --git a/src/components/map/vector/Lines.vue b/src/components/map/vector/Lines.vue index 65fc0a1..e0e2350 100644 --- a/src/components/map/vector/Lines.vue +++ b/src/components/map/vector/Lines.vue @@ -83,9 +83,10 @@ export default defineComponent({ const layer = updateLine(layers.get(update.id), update.payload as DynmapLine, converter) if(!layers.has(update.id)) { - layers.set(update.id, layer); props.layerGroup.addLayer(layer); } + + layers.set(update.id, layer); } } diff --git a/src/components/map/vector/Markers.vue b/src/components/map/vector/Markers.vue index c711fd8..0030441 100644 --- a/src/components/map/vector/Markers.vue +++ b/src/components/map/vector/Markers.vue @@ -79,7 +79,13 @@ export default defineComponent({ if(update.removed) { deleteMarker(update.id); } else { - layers.set(update.id, updateMarker(layers.get(update.id), update.payload as DynmapMarker, projection)); + const layer = updateMarker(layers.get(update.id), update.payload as DynmapMarker, projection); + + if(!layers.has(update.id)) { + props.layerGroup.addLayer(layer); + } + + layers.set(update.id, layer); } }