From c5f8644587ea92564a4d7104a6e50ea8ecfb584b Mon Sep 17 00:00:00 2001 From: James Lyne Date: Tue, 18 May 2021 23:07:25 +0100 Subject: [PATCH] Fix hidebydefault preventing player marker player being added to the layer control --- src/components/map/layer/PlayersLayer.vue | 7 ++++++- src/leaflet/layer/LayerManager.ts | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/map/layer/PlayersLayer.vue b/src/components/map/layer/PlayersLayer.vue index 12451bd..2a4afcf 100644 --- a/src/components/map/layer/PlayersLayer.vue +++ b/src/components/map/layer/PlayersLayer.vue @@ -42,7 +42,7 @@ export default defineComponent({ playerPane = props.leaflet.createPane('players'), players = computed(() => store.state.players), playerCount = computed(() => store.state.players.size), - componentSettings = store.state.components.playerMarkers, + componentSettings = computed(() => store.state.components.playerMarkers), layerGroup = new LayerGroup([],{ pane: 'players' }); @@ -63,6 +63,11 @@ export default defineComponent({ true, useStore().state.messages.players, this.componentSettings!.layerPriority); + } else { + this.leaflet.getLayerManager().addHiddenLayer( + this.layerGroup, + useStore().state.messages.players, + this.componentSettings!.layerPriority); } }, diff --git a/src/leaflet/layer/LayerManager.ts b/src/leaflet/layer/LayerManager.ts index 7587542..c88debe 100644 --- a/src/leaflet/layer/LayerManager.ts +++ b/src/leaflet/layer/LayerManager.ts @@ -32,16 +32,13 @@ export default class LayerManager { }); if(showControl.value) { - console.log('adding'); this.map.addControl(this.layerControl); } watch(showControl, (show) => { if(show) { - console.log('adding 2'); this.map.addControl(this.layerControl); } else { - console.log('removing'); this.map.removeControl(this.layerControl); } })