less spam of events, fix nesting headers (again)

This commit is contained in:
Henry Jameson 2025-11-20 21:54:52 +02:00
commit 63535b1494
2 changed files with 28 additions and 14 deletions

View file

@ -96,15 +96,18 @@ const SettingsModalContent = {
useInterfaceStore().clearSettingsModalTargetTab() useInterfaceStore().clearSettingsModalTargetTab()
}, },
nestedTooBig () { nestedTooBig () {
this.navCollapsed = false if (this.navCollapsed) {
this.$refs.tabSwitcher.showNav() this.navCollapsed = false
this.$refs.tabSwitcher.showNav()
}
}, },
nestedTooSmall () { nestedTooSmall () {
this.navCollapsed = true if (!this.navCollapsed) {
this.$refs.tabSwitcher.hideNav() this.navCollapsed = true
this.$refs.tabSwitcher.hideNav()
}
}, },
nestedNavSide (side) { nestedNavSide (side) {
console.log('SWITCH')
this.navHideHeader = side === 'content' this.navHideHeader = side === 'content'
} }
}, },

View file

@ -104,24 +104,35 @@ export default {
this.changeNavSide('content') this.changeNavSide('content')
}, },
showNav () { showNav () {
this.navMode = false if (this.navMode) {
this.navMode = false
this.changeNavSide(null)
this.onResize()
}
}, },
hideNav () { hideNav () {
this.navMode = true if (!this.navMode) {
this.navMode = true
this.changeNavSide('content')
this.onResize()
}
}, },
changeNavSide (side) { changeNavSide (side) {
this.navSide = side if (this.navSide !== side) {
this.$emit('sideSwitch', side) this.navSide = side
this.$emit('sideSwitch', side)
}
}, },
getNavMode () { getNavMode () {
return this.navMode return this.navMode
}, },
onResize () { onResize () {
// All other tabs are hidden and their width is most likely 0 // All other tabs are hidden and their width is most likely 0
const tabContent = this.$refs.contents?.querySelector('.tab-content-wrapper.-active .tab-content') const tabContent = this.$refs.contents.querySelector('.tab-content-wrapper.-active .tab-content')
const tabContentWidth = tabContent.clientWidth const tabContentWidth = tabContent.clientWidth
const navWidth = this.$refs.nav?.clientWidth
const contentsWidth = this.$refs.contents?.clientWidth const navWidth = this.$refs.nav.clientWidth
const contentsWidth = this.$refs.contents.clientWidth
// if contents takes more space than its container // if contents takes more space than its container
if (contentsWidth < tabContentWidth) { if (contentsWidth < tabContentWidth) {
@ -193,8 +204,8 @@ export default {
: '' : ''
const headerClasses = ['tab-content-label'] const headerClasses = ['tab-content-label']
console.log(this.hideHeader) if (this.hideHeader === true) {
if (this.hideHeader) { console.log('A', this.hideHeader)
headerClasses.push('-hidden') headerClasses.push('-hidden')
} }
const header = ( const header = (