escape marker-set id when saving to local storage

This commit is contained in:
Lukas Rieger (Blue) 2023-06-19 11:42:25 +02:00
parent 76e3c4e758
commit 2f78f75a90
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -61,7 +61,7 @@ export class MarkerSet extends Scene {
this.markerSets.filter(markerSet => markerSet.listed).length > 0
},
saveState: () => {
setLocalStorage("markerset-" + this.data.id + "-visible", this.visible);
setLocalStorage(this.localStorageKey("visible"), this.visible);
}
});
@ -71,7 +71,7 @@ export class MarkerSet extends Scene {
});
if (this.data.toggleable) {
let storedVisible = getLocalStorage("markerset-" + this.data.id + "-visible");
let storedVisible = getLocalStorage(this.localStorageKey("visible"));
if (storedVisible !== undefined) {
this.visible = !!storedVisible;
} else if (this.data.defaultHide) {
@ -229,4 +229,8 @@ export class MarkerSet extends Scene {
});
}
localStorageKey(key) {
return "bluemap-markerset-" + encodeURIComponent(this.data.id) + "-" + key;
}
}