Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions widgets/Section.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,31 @@ function sectionProto:OnCreate()
end

function sectionProto:OnShow()
local isFreeSpaceSection = self.key == "Free space#Free space"
local keySection = self.container:GetSection("Key", "Key")

for button in pairs(self.buttons) do
button:Show()
local buttonFamilyIsKeyChain = button.bagFamily == 256 or (button:IsStack() and button:GetBagFamily() == 256)
local shouldShow = not (keySection:IsCollapsed() and isFreeSpaceSection and buttonFamilyIsKeyChain)
if shouldShow then
button:Show()
end
end
end

function sectionProto:OnHide()
for button in pairs(self.buttons) do
button:Hide()
end
-- Also hide free keys section in the "Free space"
if self.key == "Key#Key" then
local section = self.container:GetSection("Free space", "Free space")
for button in pairs(section.buttons) do
if button.bagFamily == 256 or (button:IsStack() and button:GetBagFamily() == 256) then
button:Hide()
end
end
end
end

function sectionProto:ToString()
Expand Down Expand Up @@ -358,9 +374,16 @@ function sectionProto:FullLayout()
return self:Hide()
end

local isFreeSpaceSection = self.key == "Free space#Free space"
local keySection = self.container:GetSection("Key", "Key")

for button in pairs(self.buttons) do
button:Show()
tinsert(buttonOrder, button)
local buttonFamilyIsKeyChain = button.bagFamily == 256 or (button:IsStack() and button:GetBagFamily() == 256)
local shouldShow = not (keySection:IsCollapsed() and isFreeSpaceSection and buttonFamilyIsKeyChain)
if shouldShow then
button:Show()
tinsert(buttonOrder, button)
end
end
tsort(buttonOrder, CompareButtons)

Expand Down