When hiding the spells tab or tree tab, only change tabs if on one of those
This commit is contained in:
@@ -42,24 +42,12 @@
|
|||||||
<v-switch
|
<v-switch
|
||||||
label="Show spells tab"
|
label="Show spells tab"
|
||||||
:input-value="!model.settings.hideSpellsTab"
|
:input-value="!model.settings.hideSpellsTab"
|
||||||
@change="value => {
|
@change="changeHideSpellsTab"
|
||||||
$emit('change', {path: ['settings','hideSpellsTab'], value: !value});
|
|
||||||
$store.commit(
|
|
||||||
'setTabForCharacterSheet',
|
|
||||||
{id: model._id, tab: 0}
|
|
||||||
);
|
|
||||||
}"
|
|
||||||
/>
|
/>
|
||||||
<v-switch
|
<v-switch
|
||||||
label="Show tree tab"
|
label="Show tree tab"
|
||||||
:input-value="model.settings.showTreeTab"
|
:input-value="model.settings.showTreeTab"
|
||||||
@change="value => {
|
@change="changeShowTreeTab"
|
||||||
$emit('change', {path: ['settings','showTreeTab'], value: !!value});
|
|
||||||
$store.commit(
|
|
||||||
'setTabForCharacterSheet',
|
|
||||||
{id: model._id, tab: 0}
|
|
||||||
);
|
|
||||||
}"
|
|
||||||
/>
|
/>
|
||||||
<text-field
|
<text-field
|
||||||
label="Hit Dice reset multiplier"
|
label="Hit Dice reset multiplier"
|
||||||
@@ -129,6 +117,34 @@ export default {
|
|||||||
},
|
},
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
changeShowTreeTab(value){
|
||||||
|
this.$emit('change', {
|
||||||
|
path: ['settings','showTreeTab'],
|
||||||
|
value: !!value
|
||||||
|
});
|
||||||
|
let currentTab = this.$store.getters.tabById(this.model._id);
|
||||||
|
if (!value && currentTab === 5){
|
||||||
|
this.$store.commit(
|
||||||
|
'setTabForCharacterSheet',
|
||||||
|
{id: this.model._id, tab: 4}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeHideSpellsTab(value){
|
||||||
|
this.$emit('change', {
|
||||||
|
path: ['settings','hideSpellsTab'],
|
||||||
|
value: !value
|
||||||
|
});
|
||||||
|
let currentTab = this.$store.getters.tabById(this.model._id);
|
||||||
|
if (!value && currentTab === 3){
|
||||||
|
this.$store.commit(
|
||||||
|
'setTabForCharacterSheet',
|
||||||
|
{id: this.model._id, tab: 4}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user