diff --git a/src/components/system/LayerTab.vue b/src/components/system/LayerTab.vue index ae60155..efd9228 100644 --- a/src/components/system/LayerTab.vue +++ b/src/components/system/LayerTab.vue @@ -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; diff --git a/src/game/layers.ts b/src/game/layers.ts index 7a43e17..4eaa4d6 100644 --- a/src/game/layers.ts +++ b/src/game/layers.ts @@ -514,8 +514,10 @@ export function addLayer(layer: RawLayer, player?: Partial): 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; }; } }