diff --git a/src/components/Menu.vue b/src/components/Menu.vue index c71fcdc..747b896 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -57,11 +57,14 @@
  • {{ Math.round(grimoire.zoom * 100) }}% - + Zoom
  • @@ -258,7 +261,7 @@ export default { "toggleMenu", "toggleNightOrder", "updateScreenshot", - "updateZoom", + "setZoom", "toggleModal" ]) } diff --git a/src/store/index.js b/src/store/index.js index 4298c95..f4ad90a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -65,8 +65,8 @@ export default new Vuex.Store({ toggleNightOrder({ grimoire }) { grimoire.isNightOrder = !grimoire.isNightOrder; }, - updateZoom({ grimoire }, by = 0) { - grimoire.zoom += by; + setZoom({ grimoire }, zoom) { + grimoire.zoom = zoom; }, setBackground({ grimoire }, background) { grimoire.background = background; diff --git a/src/store/persistence.js b/src/store/persistence.js index e7238b9..c48540f 100644 --- a/src/store/persistence.js +++ b/src/store/persistence.js @@ -1,8 +1,11 @@ module.exports = store => { // initialize data - if (localStorage.background !== undefined) { + if (localStorage.getItem("background")) { store.commit("setBackground", localStorage.background); } + if (localStorage.getItem("zoom")) { + store.commit("setZoom", parseFloat(localStorage.getItem("zoom"))); + } if (localStorage.isPublic !== undefined) { store.commit("toggleGrimoire", JSON.parse(localStorage.isPublic)); } @@ -56,6 +59,13 @@ module.exports = store => { localStorage.removeItem("background"); } break; + case "setZoom": + if (payload !== 1) { + localStorage.setItem("zoom", payload); + } else { + localStorage.removeItem("zoom"); + } + break; case "setEdition": if (payload === "custom") { localStorage.removeItem("edition");