fix: UI simetry optimized
This commit is contained in:
+123
@@ -144,6 +144,34 @@ function Theme:GetQualityBorderStyle()
|
|||||||
return self:GetValue("qualityBorderStyle") or "rounded"
|
return self:GetValue("qualityBorderStyle") or "rounded"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Get frame padding values (reduced for pfUI borderless style)
|
||||||
|
function Theme:GetFramePadding()
|
||||||
|
local style = self:GetSlotStyle()
|
||||||
|
if style == "square" then
|
||||||
|
return {
|
||||||
|
containerExtra = 10, -- added to columns*size for container width
|
||||||
|
frameExtra = 10, -- added to containerWidth for frame width
|
||||||
|
titleHeight = 28,
|
||||||
|
searchBarHeight = 28,
|
||||||
|
footerHeight = 35,
|
||||||
|
footerHiddenHeight = 5,
|
||||||
|
startX = 10,
|
||||||
|
startY = -2,
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
containerExtra = 20,
|
||||||
|
frameExtra = 20,
|
||||||
|
titleHeight = 40,
|
||||||
|
searchBarHeight = 30,
|
||||||
|
footerHeight = 45,
|
||||||
|
footerHiddenHeight = 10,
|
||||||
|
startX = 10,
|
||||||
|
startY = -2,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Get border config based on hideBorders setting
|
-- Get border config based on hideBorders setting
|
||||||
local function GetBorderConfig(t)
|
local function GetBorderConfig(t)
|
||||||
local hideBorders = false
|
local hideBorders = false
|
||||||
@@ -498,6 +526,12 @@ function Theme:ApplyToAllFrames()
|
|||||||
-- Update header button backgrounds
|
-- Update header button backgrounds
|
||||||
self:ApplyHeaderButtonBackgrounds()
|
self:ApplyHeaderButtonBackgrounds()
|
||||||
|
|
||||||
|
-- Update search box styling
|
||||||
|
self:ApplySearchBoxStyle()
|
||||||
|
|
||||||
|
-- Adjust frame padding for borderless/pfUI themes
|
||||||
|
self:ApplyFramePadding()
|
||||||
|
|
||||||
ThemeDebug("=== ApplyToAllFrames done ===")
|
ThemeDebug("=== ApplyToAllFrames done ===")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -595,6 +629,95 @@ function Theme:ApplyHeaderButtonBackgrounds()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Apply square/rounded styling to search boxes
|
||||||
|
function Theme:ApplySearchBoxStyle()
|
||||||
|
local slotStyle = self:GetSlotStyle()
|
||||||
|
local searchBoxNames = {
|
||||||
|
"Guda_BagFrame_SearchBar_SearchBox",
|
||||||
|
"Guda_BankFrame_SearchBar_SearchBox",
|
||||||
|
}
|
||||||
|
for _, name in ipairs(searchBoxNames) do
|
||||||
|
local box = getglobal(name)
|
||||||
|
if box then
|
||||||
|
-- Hide InputBoxTemplate border textures (Left, Right, Middle)
|
||||||
|
local left = getglobal(name .. "Left")
|
||||||
|
local right = getglobal(name .. "Right")
|
||||||
|
local mid = getglobal(name .. "Middle")
|
||||||
|
if slotStyle == "square" then
|
||||||
|
if left then left:Hide() end
|
||||||
|
if right then right:Hide() end
|
||||||
|
if mid then mid:Hide() end
|
||||||
|
-- Apply pfUI-style backdrop
|
||||||
|
box:SetBackdrop({
|
||||||
|
bgFile = "Interface\\Buttons\\WHITE8x8",
|
||||||
|
edgeFile = "Interface\\Buttons\\WHITE8x8",
|
||||||
|
edgeSize = 1,
|
||||||
|
insets = { left = -1, right = -1, top = -1, bottom = -1 },
|
||||||
|
})
|
||||||
|
box:SetBackdropColor(0, 0, 0, 1)
|
||||||
|
box:SetBackdropBorderColor(0.2, 0.2, 0.2, 1)
|
||||||
|
-- Reposition flush left at x=10
|
||||||
|
box:ClearAllPoints()
|
||||||
|
box:SetPoint("LEFT", box:GetParent(), "LEFT", 8, 0)
|
||||||
|
box:SetPoint("RIGHT", box:GetParent(), "RIGHT", -7, 0)
|
||||||
|
-- Add text padding inside the field
|
||||||
|
box:SetTextInsets(5, 5, 0, 0)
|
||||||
|
else
|
||||||
|
if left then left:Show() end
|
||||||
|
if right then right:Show() end
|
||||||
|
if mid then mid:Show() end
|
||||||
|
box:SetBackdrop(nil)
|
||||||
|
-- Restore default anchors
|
||||||
|
box:ClearAllPoints()
|
||||||
|
box:SetPoint("LEFT", box:GetParent(), "LEFT", 15, 0)
|
||||||
|
box:SetPoint("RIGHT", box:GetParent(), "RIGHT", -12, 0)
|
||||||
|
-- Restore default text insets
|
||||||
|
box:SetTextInsets(3, 3, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Adjust header/footer padding to match theme border style
|
||||||
|
function Theme:ApplyFramePadding()
|
||||||
|
local slotStyle = self:GetSlotStyle()
|
||||||
|
-- Only adjust for pfUI/square style; otherwise restore defaults
|
||||||
|
local isPfui = (slotStyle == "square")
|
||||||
|
|
||||||
|
-- BagFrame adjustments
|
||||||
|
local bagFrameElements = {
|
||||||
|
{ name = "Guda_BagFrame_Title", pfui = { "TOP", nil, "TOP", 0, -8 }, default = { "TOP", nil, "TOP", 0, -12 } },
|
||||||
|
{ name = "Guda_BagFrame_CloseButton", pfui = { "TOPRIGHT", nil, "TOPRIGHT", -5, -5 }, default = { "TOPRIGHT", nil, "TOPRIGHT", -13, -10 } },
|
||||||
|
{ name = "Guda_BagFrame_CharsButton", pfui = { "TOPLEFT", nil, "TOPLEFT", 10, -8 }, default = { "TOPLEFT", nil, "TOPLEFT", 21, -15 } },
|
||||||
|
{ name = "Guda_BagFrame_SearchBar", pfui = { "TOP", nil, "TOP", 0, -28 }, default = { "TOP", nil, "TOP", 0, -40 } },
|
||||||
|
{ name = "Guda_BagFrame_Toolbar", pfui = { "BOTTOMLEFT", nil, "BOTTOMLEFT", 5, 5 }, default = { "BOTTOMLEFT", nil, "BOTTOMLEFT", 10, 5 } },
|
||||||
|
}
|
||||||
|
for _, elem in ipairs(bagFrameElements) do
|
||||||
|
local frame = getglobal(elem.name)
|
||||||
|
if frame then
|
||||||
|
local pos = isPfui and elem.pfui or elem.default
|
||||||
|
local parent = frame:GetParent()
|
||||||
|
frame:ClearAllPoints()
|
||||||
|
frame:SetPoint(pos[1], parent, pos[3], pos[4], pos[5])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- BankFrame adjustments (similar structure)
|
||||||
|
local bankFrameElements = {
|
||||||
|
{ name = "Guda_BankFrame_Title", pfui = { "TOP", nil, "TOP", 0, -8 }, default = { "TOP", nil, "TOP", 0, -12 } },
|
||||||
|
{ name = "Guda_BankFrame_CloseButton", pfui = { "TOPRIGHT", nil, "TOPRIGHT", -5, -5 }, default = { "TOPRIGHT", nil, "TOPRIGHT", -13, -10 } },
|
||||||
|
}
|
||||||
|
for _, elem in ipairs(bankFrameElements) do
|
||||||
|
local frame = getglobal(elem.name)
|
||||||
|
if frame then
|
||||||
|
local pos = isPfui and elem.pfui or elem.default
|
||||||
|
local parent = frame:GetParent()
|
||||||
|
frame:ClearAllPoints()
|
||||||
|
frame:SetPoint(pos[1], parent, pos[3], pos[4], pos[5])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Clear cache (call when theme setting changes)
|
-- Clear cache (call when theme setting changes)
|
||||||
function Theme:ClearCache()
|
function Theme:ClearCache()
|
||||||
cachedTheme = nil
|
cachedTheme = nil
|
||||||
|
|||||||
+11
-3
@@ -1033,8 +1033,12 @@ function BagFrame:DisplayItemsByCategory(bagData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Layout
|
-- Layout (theme-aware padding)
|
||||||
local startX, startY = 10, -10
|
local _pad = { startX = 10, startY = -10 }
|
||||||
|
if addon.Modules and addon.Modules.Theme and addon.Modules.Theme.GetFramePadding then
|
||||||
|
_pad = addon.Modules.Theme:GetFramePadding()
|
||||||
|
end
|
||||||
|
local startX, startY = _pad.startX, _pad.startY
|
||||||
local currentX, currentY = 0, 0
|
local currentX, currentY = 0, 0
|
||||||
local rowMaxHeight = 0
|
local rowMaxHeight = 0
|
||||||
local headerIdx = 1
|
local headerIdx = 1
|
||||||
@@ -1347,7 +1351,11 @@ end
|
|||||||
|
|
||||||
-- Display items
|
-- Display items
|
||||||
function BagFrame:DisplayItems(bagData, isOtherChar, charName)
|
function BagFrame:DisplayItems(bagData, isOtherChar, charName)
|
||||||
local x, y = 10, -10
|
local _pad = { startX = 10, startY = -10 }
|
||||||
|
if addon.Modules and addon.Modules.Theme and addon.Modules.Theme.GetFramePadding then
|
||||||
|
_pad = addon.Modules.Theme:GetFramePadding()
|
||||||
|
end
|
||||||
|
local x, y = _pad.startX, _pad.startY
|
||||||
local row = 0
|
local row = 0
|
||||||
local col = 0
|
local col = 0
|
||||||
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
||||||
|
|||||||
+28
-16
@@ -834,8 +834,12 @@ function BankFrame:DisplayItemsByCategory(bankData, isOtherChar, charName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Layout
|
-- Layout (theme-aware padding)
|
||||||
local startX, startY = 5, -10
|
local _pad = { startX = 5, startY = -10 }
|
||||||
|
if addon.Modules and addon.Modules.Theme and addon.Modules.Theme.GetFramePadding then
|
||||||
|
_pad = addon.Modules.Theme:GetFramePadding()
|
||||||
|
end
|
||||||
|
local startX, startY = _pad.startX, _pad.startY
|
||||||
local currentX, currentY = 0, 0
|
local currentX, currentY = 0, 0
|
||||||
local rowMaxHeight = 0
|
local rowMaxHeight = 0
|
||||||
local headerIdx = 1
|
local headerIdx = 1
|
||||||
@@ -1108,7 +1112,11 @@ end
|
|||||||
|
|
||||||
-- Display items
|
-- Display items
|
||||||
function BankFrame:DisplayItems(bankData, isOtherChar, charName)
|
function BankFrame:DisplayItems(bankData, isOtherChar, charName)
|
||||||
local x, y = 5, -10
|
local _pad = { startX = 5, startY = -10 }
|
||||||
|
if addon.Modules and addon.Modules.Theme and addon.Modules.Theme.GetFramePadding then
|
||||||
|
_pad = addon.Modules.Theme:GetFramePadding()
|
||||||
|
end
|
||||||
|
local x, y = _pad.startX, _pad.startY
|
||||||
local row = 0
|
local row = 0
|
||||||
local col = 0
|
local col = 0
|
||||||
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
||||||
@@ -1270,10 +1278,16 @@ function BankFrame:ResizeFrame(currentRow, currentCol, columns, overrideHeight)
|
|||||||
columns = 1
|
columns = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Calculate required dimensions
|
-- Get theme-aware padding
|
||||||
local containerWidth = (columns * (buttonSize + spacing)) + 10
|
local pad = { containerExtra = 20, frameExtra = 20, titleHeight = 40, searchBarHeight = 30, footerHeight = 45, footerHiddenHeight = 10 }
|
||||||
local containerHeight = overrideHeight or ((totalRows * (buttonSize + spacing)) + 20)
|
if addon.Modules and addon.Modules.Theme and addon.Modules.Theme.GetFramePadding then
|
||||||
local frameWidth = containerWidth + 30
|
pad = addon.Modules.Theme:GetFramePadding()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Calculate required dimensions (symmetric: startX padding on both sides, no trailing spacing)
|
||||||
|
local containerWidth = columns * (buttonSize + spacing) - spacing + 2 * pad.startX
|
||||||
|
local containerHeight = overrideHeight or (totalRows * (buttonSize + spacing) - spacing + 2 * math.abs(pad.startY))
|
||||||
|
local frameWidth = containerWidth + pad.frameExtra
|
||||||
|
|
||||||
-- Check if search bar is visible
|
-- Check if search bar is visible
|
||||||
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
|
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
|
||||||
@@ -1281,28 +1295,26 @@ function BankFrame:ResizeFrame(currentRow, currentCol, columns, overrideHeight)
|
|||||||
showSearchBar = true
|
showSearchBar = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Adjust frame height based on search bar visibility
|
local titleHeight = pad.titleHeight
|
||||||
-- Footer height varies: less space when search bar is hidden
|
local searchBarHeight = pad.searchBarHeight
|
||||||
local titleHeight = 40
|
local footerHeight = pad.footerHeight
|
||||||
local searchBarHeight = 30
|
|
||||||
local footerHeight = 40
|
|
||||||
local frameHeight
|
local frameHeight
|
||||||
|
|
||||||
local hideFooter = addon.Modules.DB:GetSetting("hideFooter")
|
local hideFooter = addon.Modules.DB:GetSetting("hideFooter")
|
||||||
|
|
||||||
if hideFooter then
|
if hideFooter then
|
||||||
footerHeight = 10 -- Small padding at bottom
|
footerHeight = pad.footerHiddenHeight
|
||||||
frameHeight = containerHeight + titleHeight + (showSearchBar and searchBarHeight or 0) + footerHeight
|
frameHeight = containerHeight + titleHeight + (showSearchBar and searchBarHeight or 0) + footerHeight
|
||||||
elseif showSearchBar then
|
elseif showSearchBar then
|
||||||
frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight -- 125 total
|
frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight
|
||||||
else
|
else
|
||||||
frameHeight = containerHeight + titleHeight + footerHeight -- 80 total
|
frameHeight = containerHeight + titleHeight + footerHeight
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Minimum sizes
|
-- Minimum sizes
|
||||||
if containerWidth < 200 then
|
if containerWidth < 200 then
|
||||||
containerWidth = 200
|
containerWidth = 200
|
||||||
frameWidth = 230
|
frameWidth = 200 + pad.frameExtra
|
||||||
end
|
end
|
||||||
if containerHeight < 150 then
|
if containerHeight < 150 then
|
||||||
containerHeight = 150
|
containerHeight = 150
|
||||||
|
|||||||
+13
-7
@@ -425,21 +425,27 @@ function Guda_ResizeFrame(frameName, containerName, currentRow, currentCol, colu
|
|||||||
local totalRows = (currentRow or 0) + 1
|
local totalRows = (currentRow or 0) + 1
|
||||||
if totalRows < 1 then totalRows = 1 end
|
if totalRows < 1 then totalRows = 1 end
|
||||||
|
|
||||||
local containerWidth = (columns * (buttonSize + spacing)) + 20
|
-- Get theme-aware padding
|
||||||
local containerHeight = overrideHeight or ((totalRows * (buttonSize + spacing)) + 20)
|
local pad = { containerExtra = 20, frameExtra = 20, titleHeight = 40, searchBarHeight = 30, footerHeight = 45, footerHiddenHeight = 10 }
|
||||||
local frameWidth = containerWidth + 20
|
if addon.Modules and addon.Modules.Theme and addon.Modules.Theme.GetFramePadding then
|
||||||
|
pad = addon.Modules.Theme:GetFramePadding()
|
||||||
|
end
|
||||||
|
|
||||||
|
local containerWidth = columns * (buttonSize + spacing) - spacing + 2 * pad.startX
|
||||||
|
local containerHeight = overrideHeight or (totalRows * (buttonSize + spacing) - spacing + 2 * math.abs(pad.startY))
|
||||||
|
local frameWidth = containerWidth + pad.frameExtra
|
||||||
|
|
||||||
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
|
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
|
||||||
if showSearchBar == nil then showSearchBar = true end
|
if showSearchBar == nil then showSearchBar = true end
|
||||||
|
|
||||||
local titleHeight = 40
|
local titleHeight = pad.titleHeight
|
||||||
local searchBarHeight = 30
|
local searchBarHeight = pad.searchBarHeight
|
||||||
local footerHeight = 45
|
local footerHeight = pad.footerHeight
|
||||||
local frameHeight
|
local frameHeight
|
||||||
|
|
||||||
local hideFooter = addon.Modules.DB:GetSetting("hideFooter")
|
local hideFooter = addon.Modules.DB:GetSetting("hideFooter")
|
||||||
if hideFooter then
|
if hideFooter then
|
||||||
footerHeight = 10
|
footerHeight = pad.footerHiddenHeight
|
||||||
frameHeight = containerHeight + titleHeight + (showSearchBar and searchBarHeight or 0) + footerHeight
|
frameHeight = containerHeight + titleHeight + (showSearchBar and searchBarHeight or 0) + footerHeight
|
||||||
elseif showSearchBar then
|
elseif showSearchBar then
|
||||||
frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight
|
frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight
|
||||||
|
|||||||
Reference in New Issue
Block a user