Fixed automated tab navs. going to the wrong tab
This commit is contained in:
@@ -218,30 +218,30 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeShowTreeTab(value) {
|
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', {
|
this.$emit('change', {
|
||||||
path: ['settings', 'showTreeTab'],
|
path: ['settings', 'showTreeTab'],
|
||||||
value: !!value
|
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) {
|
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', {
|
this.$emit('change', {
|
||||||
path: ['settings', 'hideSpellsTab'],
|
path: ['settings', 'hideSpellsTab'],
|
||||||
value: !value
|
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) {
|
allUserLibrariesChange(value, ack) {
|
||||||
toggleAllUserLibraries.call({
|
toggleAllUserLibraries.call({
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$store.commit(
|
this.$store.commit(
|
||||||
'setTabForCharacterSheet',
|
'setTabForCharacterSheet',
|
||||||
{id: creatureId, tab: 5}
|
{id: creatureId, tab: 'build'}
|
||||||
);
|
);
|
||||||
this.$emit('pop', creatureId);
|
this.$emit('pop', creatureId);
|
||||||
defer(() => {
|
defer(() => {
|
||||||
|
|||||||
@@ -50,6 +50,19 @@ const store = new Vuex.Store({
|
|||||||
document.title = value;
|
document.title = value;
|
||||||
},
|
},
|
||||||
setTabForCharacterSheet(state, { tab, id }) {
|
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);
|
Vue.set(state.characterSheetTabs, id, tab);
|
||||||
},
|
},
|
||||||
setShowDetailsDialog(state, value) {
|
setShowDetailsDialog(state, value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user