From bd2a0c7b5606421d25a18bd8bb5213bd3aa030fd Mon Sep 17 00:00:00 2001 From: cupkax Date: Sun, 23 Aug 2026 21:56:50 +0000 Subject: [PATCH] Apply changes from https://github.com/PathOfBuildingCommunity/PathOfBuilding/pull/10204 --- src/Classes/ConfigTab.lua | 18 ++++++++++++++++++ src/Classes/ConfigTab.lua.rej | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/Classes/ConfigTab.lua.rej diff --git a/src/Classes/ConfigTab.lua b/src/Classes/ConfigTab.lua index 83c649b476..c9426340a6 100644 --- a/src/Classes/ConfigTab.lua +++ b/src/Classes/ConfigTab.lua @@ -62,6 +62,10 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont self.toggleConfigs = not self.toggleConfigs end) + local function isCollapsed(section) + return self:IsSectionCollapsed(section) + end + local function searchMatch(varData) local searchStr = self.controls.search.buf:lower():gsub("[%-%.%+%[%]%$%^%%%?%*]", "%%%0") if searchStr and searchStr:match("%S") then @@ -633,6 +637,15 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont end end + local ownSection = lastSection + local eligibleShown = control.shown + control.shown = function() + if isCollapsed(ownSection) then + return false + end + return type(eligibleShown) == "boolean" and eligibleShown or eligibleShown() + end + t_insert(self.controls, control) t_insert(lastSection.varControlList, control) end @@ -815,6 +828,10 @@ function ConfigTabClass:Draw(viewPort, inputEvents) for _, section in ipairs(self.sectionList) do local y = 14 section.shown = true + -- Probe with the section expanded, so a collapsed section that still has + -- eligible options keeps its (clickable) header on screen + local collapsed = section.collapsed + section.collapsed = false local doShow = false for _, varControl in pairs(section.varControlList) do if varControl:IsShown() then @@ -825,6 +842,7 @@ function ConfigTabClass:Draw(viewPort, inputEvents) y = y + height + 4 end end + section.collapsed = collapsed section.shown = doShow if doShow then local width, height = section:GetSize() diff --git a/src/Classes/ConfigTab.lua.rej b/src/Classes/ConfigTab.lua.rej new file mode 100644 index 0000000000..3e5faae9c5 --- /dev/null +++ b/src/Classes/ConfigTab.lua.rej @@ -0,0 +1,17 @@ +diff a/src/Classes/ConfigTab.lua b/src/Classes/ConfigTab.lua (rejected hunks) +@@ -258,12 +258,12 @@ function ConfigTabClass:ConfigTab(build) + lastSection.varControlList = { } + lastSection.col = varData.col + lastSection.collapsed = false +- lastSection.height = function(self) +- if self.collapsed then ++ lastSection.height = function(section) ++ if isCollapsed(section) then + return 16 + end + local height = 20 +- for _, varControl in pairs(self.varControlList) do ++ for _, varControl in pairs(section.varControlList) do + if varControl:IsShown() then + local _, ctrlHeight = varControl:GetSize() + height = height + m_max(ctrlHeight or varControl.height, 16) + 4