fix: category toggle
This commit is contained in:
+18
-26
@@ -323,6 +323,17 @@ function BagFrame:Update()
|
|||||||
|
|
||||||
-- Display items
|
-- Display items
|
||||||
local viewType = addon.Modules.DB:GetSetting("bagViewType") or "single"
|
local viewType = addon.Modules.DB:GetSetting("bagViewType") or "single"
|
||||||
|
|
||||||
|
-- Reset all section headers before displaying items
|
||||||
|
local i = 1
|
||||||
|
while true do
|
||||||
|
local header = getglobal("Guda_BagFrame_SectionHeader" .. i)
|
||||||
|
if not header then break end
|
||||||
|
header.inUse = false
|
||||||
|
header:Hide()
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
|
||||||
if viewType == "category" then
|
if viewType == "category" then
|
||||||
self:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
self:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
||||||
else
|
else
|
||||||
@@ -335,20 +346,9 @@ function BagFrame:Update()
|
|||||||
-- Update bag slots info
|
-- Update bag slots info
|
||||||
self:UpdateBagSlotsInfo(bagData, isOtherChar)
|
self:UpdateBagSlotsInfo(bagData, isOtherChar)
|
||||||
|
|
||||||
-- Update bagline layout (hover option)
|
-- Update bagline layout (hover option)
|
||||||
self:UpdateBaglineLayout()
|
self:UpdateBaglineLayout()
|
||||||
|
|
||||||
-- Clean up unused section headers
|
|
||||||
local i = 1
|
|
||||||
while true do
|
|
||||||
local header = getglobal("Guda_BagFrame_SectionHeader" .. i)
|
|
||||||
if not header then break end
|
|
||||||
if not header.inUse then
|
|
||||||
header:Hide()
|
|
||||||
end
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Clean up unused buttons AFTER display is complete (prevents drag/drop issues)
|
-- Clean up unused buttons AFTER display is complete (prevents drag/drop issues)
|
||||||
for _, bagParent in pairs(bagParents) do
|
for _, bagParent in pairs(bagParents) do
|
||||||
if bagParent then
|
if bagParent then
|
||||||
@@ -398,15 +398,6 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
local perRow = addon.Modules.DB:GetSetting("bagColumns") or 10
|
local perRow = addon.Modules.DB:GetSetting("bagColumns") or 10
|
||||||
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
|
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
|
||||||
|
|
||||||
-- Reset headers
|
|
||||||
local idx = 1
|
|
||||||
while true do
|
|
||||||
local h = getglobal("Guda_BagFrame_SectionHeader" .. idx)
|
|
||||||
if not h then break end
|
|
||||||
h.inUse = false
|
|
||||||
idx = idx + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Group items by category
|
-- Group items by category
|
||||||
local categories = {}
|
local categories = {}
|
||||||
local categoryList = {
|
local categoryList = {
|
||||||
@@ -510,8 +501,9 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Update container height
|
-- Update container height
|
||||||
itemContainer:SetHeight(math.abs(y) + 20)
|
local finalHeight = math.abs(y) + 20
|
||||||
self:UpdateFrameSize()
|
itemContainer:SetHeight(finalHeight)
|
||||||
|
self:ResizeFrame(nil, nil, perRow, finalHeight)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Display items
|
-- Display items
|
||||||
@@ -676,12 +668,12 @@ function BagFrame:DisplayItems(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Resize frame based on number of rows and columns
|
-- Resize frame based on number of rows and columns
|
||||||
function BagFrame:ResizeFrame(currentRow, currentCol, columns)
|
function BagFrame:ResizeFrame(currentRow, currentCol, columns, overrideHeight)
|
||||||
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
||||||
local spacing = addon.Modules.DB:GetSetting("iconSpacing") or addon.Constants.BUTTON_SPACING
|
local spacing = addon.Modules.DB:GetSetting("iconSpacing") or addon.Constants.BUTTON_SPACING
|
||||||
|
|
||||||
-- Calculate actual number of rows used
|
-- Calculate actual number of rows used
|
||||||
local totalRows = currentRow + 1
|
local totalRows = (currentRow or 0) + 1
|
||||||
|
|
||||||
-- Ensure at least 1 row
|
-- Ensure at least 1 row
|
||||||
if totalRows < 1 then
|
if totalRows < 1 then
|
||||||
@@ -690,7 +682,7 @@ function BagFrame:ResizeFrame(currentRow, currentCol, columns)
|
|||||||
|
|
||||||
-- Calculate required dimensions based on columns
|
-- Calculate required dimensions based on columns
|
||||||
local containerWidth = (columns * (buttonSize + spacing)) + 20
|
local containerWidth = (columns * (buttonSize + spacing)) + 20
|
||||||
local containerHeight = (totalRows * (buttonSize + spacing)) + 20
|
local containerHeight = overrideHeight or ((totalRows * (buttonSize + spacing)) + 20)
|
||||||
local frameWidth = containerWidth + 20
|
local frameWidth = containerWidth + 20
|
||||||
|
|
||||||
-- Check if search bar is visible
|
-- Check if search bar is visible
|
||||||
|
|||||||
+17
-25
@@ -178,6 +178,17 @@ function BankFrame:Update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local viewType = addon.Modules.DB:GetSetting("bankViewType") or "single"
|
local viewType = addon.Modules.DB:GetSetting("bankViewType") or "single"
|
||||||
|
|
||||||
|
-- Reset all section headers before displaying items
|
||||||
|
local i = 1
|
||||||
|
while true do
|
||||||
|
local header = getglobal("Guda_BankFrame_SectionHeader" .. i)
|
||||||
|
if not header then break end
|
||||||
|
header.inUse = false
|
||||||
|
header:Hide()
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
|
||||||
if viewType == "category" then
|
if viewType == "category" then
|
||||||
self:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
self:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
||||||
else
|
else
|
||||||
@@ -190,17 +201,6 @@ function BankFrame:Update()
|
|||||||
-- Update bank slots info
|
-- Update bank slots info
|
||||||
self:UpdateBankSlotsInfo(bankData, isOtherChar)
|
self:UpdateBankSlotsInfo(bankData, isOtherChar)
|
||||||
|
|
||||||
-- Clean up unused section headers
|
|
||||||
local i = 1
|
|
||||||
while true do
|
|
||||||
local header = getglobal("Guda_BankFrame_SectionHeader" .. i)
|
|
||||||
if not header then break end
|
|
||||||
if not header.inUse then
|
|
||||||
header:Hide()
|
|
||||||
end
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Clean up unused buttons AFTER display is complete (prevents drag/drop issues)
|
-- Clean up unused buttons AFTER display is complete (prevents drag/drop issues)
|
||||||
for _, bankBagParent in pairs(bankBagParents) do
|
for _, bankBagParent in pairs(bankBagParents) do
|
||||||
if bankBagParent then
|
if bankBagParent then
|
||||||
@@ -250,15 +250,6 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
local perRow = addon.Modules.DB:GetSetting("bankColumns") or 10
|
local perRow = addon.Modules.DB:GetSetting("bankColumns") or 10
|
||||||
local itemContainer = getglobal("Guda_BankFrame_ItemContainer")
|
local itemContainer = getglobal("Guda_BankFrame_ItemContainer")
|
||||||
|
|
||||||
-- Reset headers
|
|
||||||
local idx = 1
|
|
||||||
while true do
|
|
||||||
local h = getglobal("Guda_BankFrame_SectionHeader" .. idx)
|
|
||||||
if not h then break end
|
|
||||||
h.inUse = false
|
|
||||||
idx = idx + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Group items by category
|
-- Group items by category
|
||||||
local categories = {}
|
local categories = {}
|
||||||
local categoryList = {
|
local categoryList = {
|
||||||
@@ -357,8 +348,9 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Update container height
|
-- Update container height
|
||||||
itemContainer:SetHeight(math.abs(y) + 20)
|
local finalHeight = math.abs(y) + 20
|
||||||
self:UpdateFrameSize()
|
itemContainer:SetHeight(finalHeight)
|
||||||
|
self:ResizeFrame(nil, nil, perRow, finalHeight)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Display items
|
-- Display items
|
||||||
@@ -495,12 +487,12 @@ function BankFrame:DisplayItems(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Resize bank frame based on number of rows and columns
|
-- Resize bank frame based on number of rows and columns
|
||||||
function BankFrame:ResizeFrame(currentRow, currentCol, columns)
|
function BankFrame:ResizeFrame(currentRow, currentCol, columns, overrideHeight)
|
||||||
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
||||||
local spacing = addon.Modules.DB:GetSetting("iconSpacing") or addon.Constants.BUTTON_SPACING
|
local spacing = addon.Modules.DB:GetSetting("iconSpacing") or addon.Constants.BUTTON_SPACING
|
||||||
|
|
||||||
-- Calculate actual number of rows used
|
-- Calculate actual number of rows used
|
||||||
local totalRows = currentRow + 1
|
local totalRows = (currentRow or 0) + 1
|
||||||
if totalRows < 1 then
|
if totalRows < 1 then
|
||||||
totalRows = 1
|
totalRows = 1
|
||||||
end
|
end
|
||||||
@@ -512,7 +504,7 @@ function BankFrame:ResizeFrame(currentRow, currentCol, columns)
|
|||||||
|
|
||||||
-- Calculate required dimensions
|
-- Calculate required dimensions
|
||||||
local containerWidth = (columns * (buttonSize + spacing)) + 10
|
local containerWidth = (columns * (buttonSize + spacing)) + 10
|
||||||
local containerHeight = (totalRows * (buttonSize + spacing)) + 20
|
local containerHeight = overrideHeight or ((totalRows * (buttonSize + spacing)) + 20)
|
||||||
local frameWidth = containerWidth + 30
|
local frameWidth = containerWidth + 30
|
||||||
|
|
||||||
-- Check if search bar is visible
|
-- Check if search bar is visible
|
||||||
|
|||||||
Reference in New Issue
Block a user