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
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)
-- Helper function to check if an item is a quest item
+23 -7
View File
@@ -1147,16 +1147,24 @@ function Guda_SettingsPopup_BagViewTypeButton_OnClick()
local current = Guda.Modules.DB:GetSetting("bagViewType") or "single"
local newValue = (current == "single") and "category" or "single"
Guda.Modules.DB:SetSetting("bagViewType", newValue)
local btn = getglobal("Guda_SettingsPopup_BagViewTypeButton")
if btn then
btn:SetText(newValue == "single" and "Bag View: Single" or "Bag View: Category")
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
Guda.Modules.BagFrame:Update()
end
if Guda_BankFrame and Guda_BankFrame:IsShown() then
Guda.Modules.BankFrame:Update()
end
end
-- Bank View Type Button OnClick
@@ -1164,16 +1172,24 @@ function Guda_SettingsPopup_BankViewTypeButton_OnClick()
local current = Guda.Modules.DB:GetSetting("bankViewType") or "single"
local newValue = (current == "single") and "category" or "single"
Guda.Modules.DB:SetSetting("bankViewType", newValue)
local btn = getglobal("Guda_SettingsPopup_BankViewTypeButton")
if btn then
btn:SetText(newValue == "single" and "Bank View: Single" or "Bank View: Category")
end
-- Refresh bank frame if it's open
if Guda_BankFrame:IsShown() then
-- 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_BankFrame and Guda_BankFrame:IsShown() then
Guda.Modules.BankFrame:Update()
end
if Guda_BagFrame:IsShown() then
Guda.Modules.BagFrame:Update()
end
end
-- Reverse Stack Sort Checkbox OnLoad