From 6ff4615cf8734eec2422a573b6e96b9db1f322f2 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Sun, 19 Jun 2022 19:57:49 +1000
Subject: Automatically save settings changes

---
 src/components/SettingsModal.vue | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'src/components/SettingsModal.vue')

diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue
index 595b145..3a8f34a 100644
--- a/src/components/SettingsModal.vue
+++ b/src/components/SettingsModal.vue
@@ -13,6 +13,7 @@ export default defineComponent({
 	methods: {
 		onCloseClick(evt: Event){
 			if (evt.target == this.$el || (this.$refs.closeIcon as typeof CloseIcon).$el.contains(evt.target)){
+				this.saveSettings();
 				this.$emit('settings-close');
 			}
 		},
@@ -38,7 +39,7 @@ export default defineComponent({
 		onTreeChg(){
 			this.$emit('tree-change');
 		},
-		onSave(){
+		saveSettings(){
 			const savedLytOpts = ['tileSpacing', 'minTileSz', 'maxTileSz', 'layoutType', 'sweepMode', 'sweepToParent', ];
 			for (let prop of savedLytOpts){
 				localStorage.setItem('lyt ' + prop, String(this.lytOpts[prop as keyof LayoutOptions]));
@@ -170,9 +171,6 @@ export default defineComponent({
 		</div>
 		<hr class="border-stone-400"/>
 		<div class="flex justify-around mt-2">
-			<r-button class="bg-stone-800 text-white" @click="onSave">
-				Save
-			</r-button>
 			<r-button class="bg-stone-800 text-white" @click="onReset">
 				Reset
 			</r-button>
-- 
cgit v1.2.3

