aboutsummaryrefslogtreecommitdiff
path: root/src/components/TutorialPane.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-06-30 00:34:27 +1000
committerTerry Truong <terry06890@gmail.com>2022-06-30 00:34:27 +1000
commitbffef15a6a29248a5e13262e210fa70a9b569523 (patch)
treee6efec9cc161c1f38be5fbe6119193b9af1f539c /src/components/TutorialPane.vue
parent4989a49f2e370b664b54ecc3f085689508d2bb6f (diff)
Don't disable actions on tut prev-click
Diffstat (limited to 'src/components/TutorialPane.vue')
-rw-r--r--src/components/TutorialPane.vue31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/components/TutorialPane.vue b/src/components/TutorialPane.vue
index c37611d..263b290 100644
--- a/src/components/TutorialPane.vue
+++ b/src/components/TutorialPane.vue
@@ -77,10 +77,12 @@ export default defineComponent({
return {
stage: 0, // Indicates the current step of the tutorial (stage 0 is the welcome message)
lastStage: 9,
- stageActions: [ // Specifies, for stages 1+, when actions are introduced (null means none)
+ disabledOnce: false, // Set to true after disabling features at stage 1
+ stageActions: [
+ // Specifies, for stages 1+, what action to enable (can repeat an action to enable nothing new)
'expand', 'collapse', 'expandToView', 'unhideAncestor',
'tileInfo', 'search', 'autoMode', 'settings', 'help',
- ] as (Action | null)[],
+ ] as Action[],
};
},
computed: {
@@ -107,26 +109,19 @@ export default defineComponent({
},
watch: {
stage(newVal, oldVal){
- // Update disabled actions
- let disabledActions = this.uiOpts.disabledActions;
- if (this.stage == 0){
- disabledActions.clear();
- return;
- }
- let currentAction = null as null | Action;
- for (let i = 0; i < this.lastStage; i++){
- let action = this.stageActions[i];
- if (action != null){
- if (i < this.stage){
- currentAction = action;
- disabledActions.delete(action);
- } else {
- disabledActions.add(action);
+ // If starting tutorial, disable 'all' actions
+ if (newVal == 1 && !this.disabledOnce){
+ for (let action of this.stageActions){
+ if (action != null){
+ this.uiOpts.disabledActions.add(action);
}
}
+ this.disabledOnce = true;
}
+ // Enable action for this stage
+ this.uiOpts.disabledActions.delete(this.stageActions[this.stage - 1]);
// Notify of new trigger-action
- this.$emit('stage-chg', currentAction);
+ this.$emit('stage-chg', this.stageActions[this.stage - 1]);
},
// Called when a trigger-action is done, and advances to the next stage
triggerFlag(){