fix: switching Category/Single view issue

This commit is contained in:
Salikh Gurgenidze
2026-01-24 15:43:43 +04:00
parent e328ad5667
commit 8612a09aa6
2 changed files with 33 additions and 7 deletions
+10
View File
@@ -57,6 +57,16 @@ function Guda_ResetButtonPool()
nextButtonID = 1 nextButtonID = 1
end end
-- Mark all buttons as available for reuse (called when switching view types)
-- This allows buttons from one frame to be reused by another
function Guda_ReleaseAllButtons()
for _, button in pairs(buttonPool) do
if not button.isBagSlot then
button.inUse = false
end
end
end
-- Use shared tooltip from Utils module (retrieved on-demand to ensure Utils is loaded) -- Use shared tooltip from Utils module (retrieved on-demand to ensure Utils is loaded)
-- Helper function to check if an item is a quest item -- Helper function to check if an item is a quest item
+19 -3
View File
@@ -1153,10 +1153,18 @@ function Guda_SettingsPopup_BagViewTypeButton_OnClick()
btn:SetText(newValue == "single" and "Bag View: Single" or "Bag View: Category") btn:SetText(newValue == "single" and "Bag View: Single" or "Bag View: Category")
end end
-- Refresh bag frame if it's open -- Release all buttons so they can be reused when switching views
if Guda_ReleaseAllButtons then
Guda_ReleaseAllButtons()
end
-- Refresh BOTH frames to ensure buttons are properly distributed
if Guda_BagFrame:IsShown() then if Guda_BagFrame:IsShown() then
Guda.Modules.BagFrame:Update() Guda.Modules.BagFrame:Update()
end end
if Guda_BankFrame and Guda_BankFrame:IsShown() then
Guda.Modules.BankFrame:Update()
end
end end
-- Bank View Type Button OnClick -- Bank View Type Button OnClick
@@ -1170,10 +1178,18 @@ function Guda_SettingsPopup_BankViewTypeButton_OnClick()
btn:SetText(newValue == "single" and "Bank View: Single" or "Bank View: Category") btn:SetText(newValue == "single" and "Bank View: Single" or "Bank View: Category")
end end
-- Refresh bank frame if it's open -- Release all buttons so they can be reused when switching views
if Guda_BankFrame:IsShown() then if Guda_ReleaseAllButtons then
Guda_ReleaseAllButtons()
end
-- Refresh BOTH frames to ensure buttons are properly distributed
if Guda_BankFrame and Guda_BankFrame:IsShown() then
Guda.Modules.BankFrame:Update() Guda.Modules.BankFrame:Update()
end end
if Guda_BagFrame:IsShown() then
Guda.Modules.BagFrame:Update()
end
end end
-- Reverse Stack Sort Checkbox OnLoad -- Reverse Stack Sort Checkbox OnLoad