From 9d01f0f1691ec04a06bead7d9bf834c47c9a93d8 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Wed, 29 Jun 2022 17:32:14 +1000
Subject: Add saved-indicator to Settings

Also, for range sliders, only save after user releases the slider
---
 src/App.vue | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 1937997..fa8ddcd 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -720,20 +720,23 @@ export default defineComponent({
 			this.resetMode();
 			this.settingsOpen = true;
 		},
-		async onSettingChg(optionType: OptionType, option: string){
+		async onSettingChg(optionType: OptionType, option: string, save = true){
 			// Save in localStorage
 			if (optionType == 'LYT'){
-				localStorage.setItem(`${optionType} ${option}`, String(this.lytOpts[option as keyof LayoutOptions]));
+				if (save){
+					localStorage.setItem(`${optionType} ${option}`, String(this.lytOpts[option as keyof LayoutOptions]));
+				}
 				this.relayoutWithCollapse();
 			} else if (optionType == 'UI') {
-				localStorage.setItem(`${optionType} ${option}`, String(this.uiOpts[option as keyof UiOptions]));
+				if (save){
+					localStorage.setItem(`${optionType} ${option}`, String(this.uiOpts[option as keyof UiOptions]));
+				}
 				if (option == 'useReducedTree'){
 					this.onTreeChange();
 				}
 			} else {
 				throw new Error(`Unexpected setting: ${optionType}, ${option}`);
 			}
-			console.log(`Saved setting: ${optionType}, ${option}`);
 		},
 		async onTreeChange(){
 			if (this.activeRoot != this.layoutTree){
-- 
cgit v1.2.3

