From 433795e52e7d8cdb783e92eb4fe2a37e1a9c638b Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 4 Sep 2021 17:37:46 -0500 Subject: [PATCH] Fixed subtab buttons not showing as selected --- src/components/system/LayerTab.vue | 5 +---- src/game/layers.ts | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) 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; }; } }