Fix hidden layers duplicating occasionally

This commit is contained in:
James Lyne 2021-05-19 03:26:57 +01:00
parent 2544a5deac
commit ff7250f081
2 changed files with 6 additions and 1 deletions

View File

@ -61,6 +61,10 @@ export default class LayerManager {
}
addHiddenLayer(layer: Layer, name: string, position: number) {
if(this.layerControl.hasLayer(layer)) {
this.layerControl.removeLayer(layer);
}
if(typeof position !== 'undefined') {
this.layerControl.addOverlayAtPosition(layer, name, position);
} else {

View File

@ -155,10 +155,11 @@ export const mutations: MutationTree<State> & Mutations = {
//Sets the existing marker sets from the last marker fetch
[MutationTypes.SET_MARKER_SETS](state: State, markerSets: Map<string, DynmapMarkerSet>) {
state.markerSets = markerSets;
state.markerSets.clear();
state.pendingSetUpdates.clear();
for(const entry of markerSets) {
state.markerSets.set(entry[0], entry[1]);
state.pendingSetUpdates.set(entry[0], {
markerUpdates: [],
areaUpdates: [],