fix: category titles
This commit is contained in:
+11
-11
@@ -373,7 +373,7 @@ function BagFrame:GetSectionHeader(index)
|
|||||||
header = CreateFrame("Frame", name, getglobal("Guda_BagFrame_ItemContainer"))
|
header = CreateFrame("Frame", name, getglobal("Guda_BagFrame_ItemContainer"))
|
||||||
header:SetHeight(20)
|
header:SetHeight(20)
|
||||||
local text = header:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
local text = header:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||||
text:SetPoint("LEFT", header, "LEFT", 5, 0)
|
text:SetPoint("LEFT", header, "LEFT", 0, 0)
|
||||||
header.text = text
|
header.text = text
|
||||||
end
|
end
|
||||||
header.inUse = true
|
header.inUse = true
|
||||||
@@ -559,7 +559,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
||||||
currentX = currentX + blockWidth + 20
|
currentX = currentX + blockWidth + 20 -- 20px gap between categories
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
|
|
||||||
if hasAnyBottom then
|
if hasAnyBottom then
|
||||||
y = y - 10
|
y = y - 10
|
||||||
local col = 0
|
local currentBottomX = 0
|
||||||
local sectionMaxHeight = 0
|
local sectionMaxHeight = 0
|
||||||
|
|
||||||
for _, sec in ipairs(bottomSections) do
|
for _, sec in ipairs(bottomSections) do
|
||||||
@@ -611,8 +611,8 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
||||||
|
|
||||||
-- Check if it fits in current row (Inline block for bottom sections too)
|
-- Check if it fits in current row (Inline block for bottom sections too)
|
||||||
if col > 0 and (col * (buttonSize + spacing)) + blockWidth > totalWidth + 5 then
|
if currentBottomX > 0 and currentBottomX + blockWidth + 20 > totalWidth + 5 then
|
||||||
col = 0
|
currentBottomX = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
end
|
end
|
||||||
@@ -620,7 +620,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
-- Add Header
|
-- Add Header
|
||||||
local header = self:GetSectionHeader(headerIdx)
|
local header = self:GetSectionHeader(headerIdx)
|
||||||
headerIdx = headerIdx + 1
|
headerIdx = headerIdx + 1
|
||||||
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + (col * (buttonSize + spacing)), y)
|
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + currentBottomX, y)
|
||||||
header:SetWidth(blockWidth)
|
header:SetWidth(blockWidth)
|
||||||
header.text:SetText(sec.name)
|
header.text:SetText(sec.name)
|
||||||
header:Show()
|
header:Show()
|
||||||
@@ -635,7 +635,7 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
button:SetWidth(buttonSize)
|
button:SetWidth(buttonSize)
|
||||||
button:SetHeight(buttonSize)
|
button:SetHeight(buttonSize)
|
||||||
button:ClearAllPoints()
|
button:ClearAllPoints()
|
||||||
button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + ((col + sCol) * (buttonSize + spacing)), itemY - (sRow * (buttonSize + spacing)))
|
button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + currentBottomX + (sCol * (buttonSize + spacing)), itemY - (sRow * (buttonSize + spacing)))
|
||||||
button:Show()
|
button:Show()
|
||||||
Guda_ItemButton_SetItem(button, item.bagID, item.slotID, item.itemData, false, isOtherChar and charName or nil, self:PassesSearchFilter(item.itemData), isOtherChar)
|
Guda_ItemButton_SetItem(button, item.bagID, item.slotID, item.itemData, false, isOtherChar and charName or nil, self:PassesSearchFilter(item.itemData), isOtherChar)
|
||||||
button.inUse = true
|
button.inUse = true
|
||||||
@@ -648,18 +648,18 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
||||||
col = col + blockCols + 1 -- Add 1 slot worth of spacing (around 40px) instead of 20px gap logic
|
currentBottomX = currentBottomX + blockWidth + 20 -- Match the 20px gap used in top categories
|
||||||
|
|
||||||
-- If we wrapped exactly at the end of a block
|
-- If we wrapped exactly at the end of a block
|
||||||
if (col * (buttonSize + spacing)) >= totalWidth then
|
if currentBottomX >= totalWidth then
|
||||||
col = 0
|
currentBottomX = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if col > 0 then
|
if currentBottomX > 0 then
|
||||||
y = y - sectionMaxHeight
|
y = y - sectionMaxHeight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+11
-11
@@ -225,7 +225,7 @@ function BankFrame:GetSectionHeader(index)
|
|||||||
header = CreateFrame("Frame", name, getglobal("Guda_BankFrame_ItemContainer"))
|
header = CreateFrame("Frame", name, getglobal("Guda_BankFrame_ItemContainer"))
|
||||||
header:SetHeight(20)
|
header:SetHeight(20)
|
||||||
local text = header:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
local text = header:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||||
text:SetPoint("LEFT", header, "LEFT", 5, 0)
|
text:SetPoint("LEFT", header, "LEFT", 0, 0)
|
||||||
header.text = text
|
header.text = text
|
||||||
end
|
end
|
||||||
header.inUse = true
|
header.inUse = true
|
||||||
@@ -424,7 +424,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
if blockHeight > rowMaxHeight then rowMaxHeight = blockHeight end
|
||||||
currentX = currentX + blockWidth + 20
|
currentX = currentX + blockWidth + 20 -- 20px gap between categories
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
|
|
||||||
if hasAnyBottom then
|
if hasAnyBottom then
|
||||||
y = y - 10
|
y = y - 10
|
||||||
local col = 0
|
local currentBottomX = 0
|
||||||
local sectionMaxHeight = 0
|
local sectionMaxHeight = 0
|
||||||
|
|
||||||
for _, sec in ipairs(bottomSections) do
|
for _, sec in ipairs(bottomSections) do
|
||||||
@@ -476,8 +476,8 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
local blockHeight = 20 + (blockRows * (buttonSize + spacing))
|
||||||
|
|
||||||
-- Check if it fits in current row (Inline block for bottom sections too)
|
-- Check if it fits in current row (Inline block for bottom sections too)
|
||||||
if col > 0 and (col * (buttonSize + spacing)) + blockWidth > totalWidth + 5 then
|
if currentBottomX > 0 and currentBottomX + blockWidth + 20 > totalWidth + 5 then
|
||||||
col = 0
|
currentBottomX = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
end
|
end
|
||||||
@@ -485,7 +485,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
-- Add Header
|
-- Add Header
|
||||||
local header = self:GetSectionHeader(headerIdx)
|
local header = self:GetSectionHeader(headerIdx)
|
||||||
headerIdx = headerIdx + 1
|
headerIdx = headerIdx + 1
|
||||||
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + (col * (buttonSize + spacing)), y)
|
header:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + currentBottomX, y)
|
||||||
header:SetWidth(blockWidth)
|
header:SetWidth(blockWidth)
|
||||||
header.text:SetText(sec.name)
|
header.text:SetText(sec.name)
|
||||||
header:Show()
|
header:Show()
|
||||||
@@ -500,7 +500,7 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
button:SetWidth(buttonSize)
|
button:SetWidth(buttonSize)
|
||||||
button:SetHeight(buttonSize)
|
button:SetHeight(buttonSize)
|
||||||
button:ClearAllPoints()
|
button:ClearAllPoints()
|
||||||
button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + ((col + sCol) * (buttonSize + spacing)), itemY - (sRow * (buttonSize + spacing)))
|
button:SetPoint("TOPLEFT", itemContainer, "TOPLEFT", x + currentBottomX + (sCol * (buttonSize + spacing)), itemY - (sRow * (buttonSize + spacing)))
|
||||||
button:Show()
|
button:Show()
|
||||||
Guda_ItemButton_SetItem(button, item.bagID, item.slotID, item.itemData, true, isOtherChar and charName or nil, self:PassesSearchFilter(item.itemData), true)
|
Guda_ItemButton_SetItem(button, item.bagID, item.slotID, item.itemData, true, isOtherChar and charName or nil, self:PassesSearchFilter(item.itemData), true)
|
||||||
button.inUse = true
|
button.inUse = true
|
||||||
@@ -513,18 +513,18 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
if blockHeight > sectionMaxHeight then sectionMaxHeight = blockHeight end
|
||||||
col = col + blockCols + 1 -- Add 1 slot worth of spacing (around 40px) instead of 20px gap logic
|
currentBottomX = currentBottomX + blockWidth + 20 -- Match the 20px gap used in top categories
|
||||||
|
|
||||||
-- If we wrapped exactly at the end of a block
|
-- If we wrapped exactly at the end of a block
|
||||||
if (col * (buttonSize + spacing)) >= totalWidth then
|
if currentBottomX >= totalWidth then
|
||||||
col = 0
|
currentBottomX = 0
|
||||||
y = y - sectionMaxHeight - 5
|
y = y - sectionMaxHeight - 5
|
||||||
sectionMaxHeight = 0
|
sectionMaxHeight = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if col > 0 then
|
if currentBottomX > 0 then
|
||||||
y = y - sectionMaxHeight
|
y = y - sectionMaxHeight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user