Fix hidden layers duplicating occasionally
This commit is contained in:
parent
2544a5deac
commit
ff7250f081
@ -61,6 +61,10 @@ export default class LayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addHiddenLayer(layer: Layer, name: string, position: number) {
|
addHiddenLayer(layer: Layer, name: string, position: number) {
|
||||||
|
if(this.layerControl.hasLayer(layer)) {
|
||||||
|
this.layerControl.removeLayer(layer);
|
||||||
|
}
|
||||||
|
|
||||||
if(typeof position !== 'undefined') {
|
if(typeof position !== 'undefined') {
|
||||||
this.layerControl.addOverlayAtPosition(layer, name, position);
|
this.layerControl.addOverlayAtPosition(layer, name, position);
|
||||||
} else {
|
} else {
|
||||||
|
@ -155,10 +155,11 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
|
|
||||||
//Sets the existing marker sets from the last marker fetch
|
//Sets the existing marker sets from the last marker fetch
|
||||||
[MutationTypes.SET_MARKER_SETS](state: State, markerSets: Map<string, DynmapMarkerSet>) {
|
[MutationTypes.SET_MARKER_SETS](state: State, markerSets: Map<string, DynmapMarkerSet>) {
|
||||||
state.markerSets = markerSets;
|
state.markerSets.clear();
|
||||||
state.pendingSetUpdates.clear();
|
state.pendingSetUpdates.clear();
|
||||||
|
|
||||||
for(const entry of markerSets) {
|
for(const entry of markerSets) {
|
||||||
|
state.markerSets.set(entry[0], entry[1]);
|
||||||
state.pendingSetUpdates.set(entry[0], {
|
state.pendingSetUpdates.set(entry[0], {
|
||||||
markerUpdates: [],
|
markerUpdates: [],
|
||||||
areaUpdates: [],
|
areaUpdates: [],
|
||||||
|
Loading…
Reference in New Issue
Block a user