Fix hidebydefault preventing player marker player being added to the layer control

This commit is contained in:
James Lyne 2021-05-18 23:07:25 +01:00
parent 6eec608eb1
commit c5f8644587
2 changed files with 6 additions and 4 deletions

View File

@ -42,7 +42,7 @@ export default defineComponent({
playerPane = props.leaflet.createPane('players'), playerPane = props.leaflet.createPane('players'),
players = computed(() => store.state.players), players = computed(() => store.state.players),
playerCount = computed(() => store.state.players.size), playerCount = computed(() => store.state.players.size),
componentSettings = store.state.components.playerMarkers, componentSettings = computed(() => store.state.components.playerMarkers),
layerGroup = new LayerGroup([],{ layerGroup = new LayerGroup([],{
pane: 'players' pane: 'players'
}); });
@ -63,6 +63,11 @@ export default defineComponent({
true, true,
useStore().state.messages.players, useStore().state.messages.players,
this.componentSettings!.layerPriority); this.componentSettings!.layerPriority);
} else {
this.leaflet.getLayerManager().addHiddenLayer(
this.layerGroup,
useStore().state.messages.players,
this.componentSettings!.layerPriority);
} }
}, },

View File

@ -32,16 +32,13 @@ export default class LayerManager {
}); });
if(showControl.value) { if(showControl.value) {
console.log('adding');
this.map.addControl(this.layerControl); this.map.addControl(this.layerControl);
} }
watch(showControl, (show) => { watch(showControl, (show) => {
if(show) { if(show) {
console.log('adding 2');
this.map.addControl(this.layerControl); this.map.addControl(this.layerControl);
} else { } else {
console.log('removing');
this.map.removeControl(this.layerControl); this.map.removeControl(this.layerControl);
} }
}) })