mirror of
				https://github.com/bra1n/townsquare.git
				synced 2025-10-21 16:55:12 +00:00 
			
		
		
		
	persist zoom level
This commit is contained in:
		
							parent
							
								
									080b1314ad
								
							
						
					
					
						commit
						ff61770150
					
				
					 3 changed files with 19 additions and 6 deletions
				
			
		|  | @ -57,11 +57,14 @@ | |||
|           <li v-if="players.length"> | ||||
|             <em> | ||||
|               <font-awesome-icon | ||||
|                 @click="updateZoom(-0.1)" | ||||
|                 @click="setZoom(grimoire.zoom - 0.1)" | ||||
|                 icon="search-minus" | ||||
|               /> | ||||
|               {{ Math.round(grimoire.zoom * 100) }}% | ||||
|               <font-awesome-icon @click="updateZoom(0.1)" icon="search-plus" /> | ||||
|               <font-awesome-icon | ||||
|                 @click="setZoom(grimoire.zoom + 0.1)" | ||||
|                 icon="search-plus" | ||||
|               /> | ||||
|             </em> | ||||
|             Zoom | ||||
|           </li> | ||||
|  | @ -258,7 +261,7 @@ export default { | |||
|       "toggleMenu", | ||||
|       "toggleNightOrder", | ||||
|       "updateScreenshot", | ||||
|       "updateZoom", | ||||
|       "setZoom", | ||||
|       "toggleModal" | ||||
|     ]) | ||||
|   } | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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"); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue