Fixed automated tab navs. going to the wrong tab
This commit is contained in:
@@ -218,30 +218,30 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
changeShowTreeTab(value) {
|
||||
let currentTab = this.$store.getters.tabNameById(this.model._id);
|
||||
if (!value && currentTab === 'tree') {
|
||||
this.$store.commit(
|
||||
'setTabForCharacterSheet',
|
||||
{ id: this.model._id, tab: 'build' }
|
||||
);
|
||||
}
|
||||
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) {
|
||||
let currentTab = this.$store.getters.tabNameById(this.model._id);
|
||||
if (!value && currentTab === 'spells') {
|
||||
this.$store.commit(
|
||||
'setTabForCharacterSheet',
|
||||
{ id: this.model._id, tab: 'actions' }
|
||||
);
|
||||
}
|
||||
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 }
|
||||
);
|
||||
}
|
||||
},
|
||||
allUserLibrariesChange(value, ack) {
|
||||
toggleAllUserLibraries.call({
|
||||
|
||||
@@ -195,7 +195,7 @@ export default {
|
||||
} else {
|
||||
this.$store.commit(
|
||||
'setTabForCharacterSheet',
|
||||
{id: creatureId, tab: 5}
|
||||
{id: creatureId, tab: 'build'}
|
||||
);
|
||||
this.$emit('pop', creatureId);
|
||||
defer(() => {
|
||||
|
||||
@@ -50,6 +50,19 @@ const store = new Vuex.Store({
|
||||
document.title = value;
|
||||
},
|
||||
setTabForCharacterSheet(state, { tab, id }) {
|
||||
// Convert tab names to tab numbers
|
||||
if (typeof tab === 'string') {
|
||||
const creature = Creatures.findOne(id);
|
||||
if (creature?.settings?.hideSpellsTab) {
|
||||
tab = tabsWithoutSpells.indexOf(tab);
|
||||
} else {
|
||||
tab = tabs.indexOf(tab);
|
||||
}
|
||||
if (!(tab > -1)) {
|
||||
throw 'Could not find requested tab';
|
||||
}
|
||||
console.log('resolved: ', tab);
|
||||
}
|
||||
Vue.set(state.characterSheetTabs, id, tab);
|
||||
},
|
||||
setShowDetailsDialog(state, value) {
|
||||
|
||||
Reference in New Issue
Block a user