fix: switching Category/Single view issue
This commit is contained in:
@@ -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
|
||||||
|
|||||||
+23
-7
@@ -1147,16 +1147,24 @@ function Guda_SettingsPopup_BagViewTypeButton_OnClick()
|
|||||||
local current = Guda.Modules.DB:GetSetting("bagViewType") or "single"
|
local current = Guda.Modules.DB:GetSetting("bagViewType") or "single"
|
||||||
local newValue = (current == "single") and "category" or "single"
|
local newValue = (current == "single") and "category" or "single"
|
||||||
Guda.Modules.DB:SetSetting("bagViewType", newValue)
|
Guda.Modules.DB:SetSetting("bagViewType", newValue)
|
||||||
|
|
||||||
local btn = getglobal("Guda_SettingsPopup_BagViewTypeButton")
|
local btn = getglobal("Guda_SettingsPopup_BagViewTypeButton")
|
||||||
if btn then
|
if btn then
|
||||||
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
|
||||||
@@ -1164,16 +1172,24 @@ function Guda_SettingsPopup_BankViewTypeButton_OnClick()
|
|||||||
local current = Guda.Modules.DB:GetSetting("bankViewType") or "single"
|
local current = Guda.Modules.DB:GetSetting("bankViewType") or "single"
|
||||||
local newValue = (current == "single") and "category" or "single"
|
local newValue = (current == "single") and "category" or "single"
|
||||||
Guda.Modules.DB:SetSetting("bankViewType", newValue)
|
Guda.Modules.DB:SetSetting("bankViewType", newValue)
|
||||||
|
|
||||||
local btn = getglobal("Guda_SettingsPopup_BankViewTypeButton")
|
local btn = getglobal("Guda_SettingsPopup_BankViewTypeButton")
|
||||||
if btn then
|
if btn then
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user