From 684c72ade0c36bf31a0aaf92c0ae8a4ff89b1eb7 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 13 Jun 2021 03:56:42 -0500 Subject: [PATCH] Added minimizing tabs --- src/components/system/LayerTab.vue | 145 ++++++++++++++++++++++++++--- src/components/system/Nav.vue | 2 +- src/components/system/Tabs.vue | 37 +------- src/components/tree/Tree.vue | 2 +- src/data/layers/aca/f.js | 1 + src/data/mod.js | 3 +- src/util/load.js | 1 + 7 files changed, 144 insertions(+), 47 deletions(-) diff --git a/src/components/system/LayerTab.vue b/src/components/system/LayerTab.vue index 42d53aa..08f69df 100644 --- a/src/components/system/LayerTab.vue +++ b/src/components/system/LayerTab.vue @@ -1,14 +1,19 @@ @@ -26,12 +31,20 @@ export default { props: { layer: String, index: Number, - forceFirstTab: Boolean + forceFirstTab: Boolean, + disableMinimize: Boolean, + tab: Function }, data() { return { allowGoBack: modInfo.allowGoBack }; }, computed: { + minimized() { + return !this.disableMinimize && player.minimized[this.layer]; + }, + name() { + return layers[this.layer].name; + }, floating() { return themes[player.theme].floatingTabs; }, @@ -76,19 +89,67 @@ export default { return this.index === 0; } }, + watch: { + minimized(newValue) { + const tab = this.tab(); + if (tab != undefined) { + if (newValue) { + tab.style.flexGrow = 0; + tab.style.flexShrink = 0; + tab.style.width = "60px"; + tab.style.margin = 0; + } else { + tab.style.flexGrow = null; + tab.style.flexShrink = null; + tab.style.width = null; + tab.style.margin = null; + } + } + } + }, + mounted() { + const tab = this.tab(); + if (tab != undefined) { + if (this.minimized) { + tab.style.flexGrow = 0; + tab.style.flexShrink = 0; + tab.style.width = "60px"; + tab.style.margin = 0; + } else { + tab.style.flexGrow = null; + tab.style.flexShrink = null; + tab.style.width = null; + tab.style.margin = null; + } + } else { + this.$nextTick(this.mounted); + } + }, methods: { selectSubtab(subtab) { if (player.subtabs[this.layer] == undefined) { player.subtabs[this.layer] = {}; } player.subtabs[this.layer].mainTabs = subtab; + }, + toggleMinimized() { + player.minimized[this.layer] = !player.minimized[this.layer]; + }, + goBack(index) { + player.tabs = player.tabs.slice(0, index); } } }; diff --git a/src/components/system/Nav.vue b/src/components/system/Nav.vue index 736c6f1..6b043b9 100644 --- a/src/components/system/Nav.vue +++ b/src/components/system/Nav.vue @@ -181,7 +181,7 @@ export default { .version { margin-left: 12px; margin-right: 12px; - margin-bottom: 7px; + margin-bottom: 5px; color: var(--points); cursor: pointer; } diff --git a/src/components/system/Tabs.vue b/src/components/system/Tabs.vue index 0275cec..94e206f 100644 --- a/src/components/system/Tabs.vue +++ b/src/components/system/Tabs.vue @@ -1,14 +1,14 @@