mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 12:05:13 +01:00
Remember hide/show status of marker-sets
This commit is contained in:
parent
85f4735050
commit
cb638910ce
@ -65,6 +65,7 @@ export default {
|
||||
if (this.markerSet.toggleable) {
|
||||
// eslint-disable-next-line vue/no-mutating-props
|
||||
this.markerSet.visible = !this.markerSet.visible
|
||||
this.markerSet.saveState();
|
||||
}
|
||||
},
|
||||
more(event) {
|
||||
|
@ -30,6 +30,7 @@ import {LineMarker} from "./LineMarker";
|
||||
import {HtmlMarker} from "./HtmlMarker";
|
||||
import {PoiMarker} from "./PoiMarker";
|
||||
import {reactive} from "vue";
|
||||
import {getLocalStorage, setLocalStorage} from "../Utils";
|
||||
|
||||
export class MarkerSet extends Scene {
|
||||
|
||||
@ -58,6 +59,9 @@ export class MarkerSet extends Scene {
|
||||
return this.toggleable ||
|
||||
this.markers.filter(marker => marker.listed).length > 0 ||
|
||||
this.markerSets.filter(markerSet => markerSet.listed).length > 0
|
||||
},
|
||||
saveState: () => {
|
||||
setLocalStorage("markerset-" + this.data.id + "-visible", this.visible);
|
||||
}
|
||||
});
|
||||
|
||||
@ -65,6 +69,15 @@ export class MarkerSet extends Scene {
|
||||
get() { return this.data.visible },
|
||||
set(value) { this.data.visible = value }
|
||||
});
|
||||
|
||||
if (this.data.toggleable) {
|
||||
let storedVisible = getLocalStorage("markerset-" + this.data.id + "-visible");
|
||||
if (storedVisible !== undefined) {
|
||||
this.visible = !!storedVisible;
|
||||
} else if (this.data.defaultHide) {
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateFromData(data) {
|
||||
@ -112,10 +125,6 @@ export class MarkerSet extends Scene {
|
||||
if (!markerSet) {
|
||||
markerSet = new MarkerSet(markerSetId);
|
||||
this.add(markerSet);
|
||||
|
||||
if (data.defaultHidden) {
|
||||
markerSet.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// update
|
||||
|
Loading…
Reference in New Issue
Block a user