fix: switching Category/Single view issue
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user