From e034e2ea9e74cf6f01ea4f978a3fb61e019c7d4b Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Fri, 24 Jun 2022 15:30:37 +1000
Subject: Hide buttons and info-icons during parts of tutorial

---
 src/components/TutorialPane.vue | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

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

diff --git a/src/components/TutorialPane.vue b/src/components/TutorialPane.vue
index d34456d..5e6c1c0 100644
--- a/src/components/TutorialPane.vue
+++ b/src/components/TutorialPane.vue
@@ -47,37 +47,46 @@ export default defineComponent({
 	methods: {
 		onStartTutorial(){
 			this.stage = 1;
-			this.sendEnabledFeatures();
+			this.setEnabledFeatures();
 		},
 		onPrevClick(){
 			this.stage = Math.max(1, this.stage - 1);
-			this.sendEnabledFeatures();
+			this.setEnabledFeatures();
 		},
 		onNextClick(){
 			this.stage = Math.min(this.maxStage, this.stage + 1);
-			this.sendEnabledFeatures();
+			this.setEnabledFeatures();
 		},
 		onClose(){
 			this.$emit('close');
 		},
-		sendEnabledFeatures(){
+		setEnabledFeatures(){
 			const stageActions = [
 				null,
 				'expand', 'expand', 'collapse', 'expandToView', 'unhideAncestor',
-				'tileInfo', 'search', 'autoMode', 'settings', 'help'
+				'tileInfo', 'search', 'autoMode', 'settings', 'help',
 			] as (Action | null)[];
-			let disabledActions = new Set() as Set<Action>;
-			for (let i = this.stage + 1; i < this.maxStage; i++){
-				disabledActions.add(stageActions[i] as Action);
+			let disabledActions = this.uiOpts.disabledActions;
+			let currentAction = stageActions[this.stage];
+			for (let i = 1; i <= this.maxStage; i++){
+				let action = stageActions[i];
+				if (i <= this.stage){
+					if (disabledActions.has(action)){
+						disabledActions.delete(action);
+					}
+				} else {
+					if (!disabledActions.has(action) && action != currentAction){
+						disabledActions.add(action);
+					}
+				}
 			}
-			disabledActions.delete(stageActions[this.stage] as Action);
-			let triggerAction = stageActions[this.stage] as Action;
-			this.$emit('stage-chg', disabledActions, triggerAction);
+			let triggerAction = currentAction;
+			this.$emit('stage-chg', triggerAction);
 		},
 	},
 	created(){
 		if (this.skipWelcome){
-			this.sendEnabledFeatures();
+			this.setEnabledFeatures();
 		}
 	},
 	components: {CloseIcon, RButton, },
-- 
cgit v1.2.3

