Fixed subtab buttons not showing as selected

This commit is contained in:
thepaperpilot 2021-09-04 17:37:46 -05:00
parent 4869f042a9
commit 433795e52e
2 changed files with 4 additions and 5 deletions

View file

@ -27,7 +27,7 @@
v-for="(subtab, id) in subtabs"
@selectTab="selectSubtab(id)"
:key="id"
:activeTab="id === activeSubtab"
:activeTab="subtab.active"
:options="subtab"
:text="id"
/>
@ -108,9 +108,6 @@ export default defineComponent({
}
return null;
},
activeSubtab(): string | undefined {
return layers[this.layer].activeSubtab?.id;
},
firstTab(): boolean {
if (this.forceFirstTab != undefined) {
return this.forceFirstTab;

View file

@ -514,8 +514,10 @@ export function addLayer(layer: RawLayer, player?: Partial<PlayerData>): void {
setDefault(player.subtabs, layer.id, {});
setDefault(player.subtabs[layer.id], "mainTabs", Object.keys(layer.subtabs)[0]);
for (const id in layer.subtabs) {
layer.subtabs[id].id = id;
layer.subtabs[id].layer = layer.id;
layer.subtabs[id].active = function() {
return playerProxy.subtabs[this.layer].mainTabs === this.id;
return layers[this.layer].activeSubtab === this;
};
}
}