fix: some ui fixes

This commit is contained in:
Salikh Gurgenidze
2025-11-20 17:31:36 +04:00
parent f1fca41325
commit 0c9b588008
7 changed files with 206 additions and 16 deletions
+5 -1
View File
@@ -41,6 +41,7 @@ function DB:Initialize()
iconFontSize = 12,
showQualityBorderEquipment = true,
showQualityBorderOther = true,
showSearchBar = true,
},
}
end
@@ -70,6 +71,9 @@ function DB:Initialize()
if Guda_CharDB.settings.showQualityBorderOther == nil then
Guda_CharDB.settings.showQualityBorderOther = true
end
if Guda_CharDB.settings.showSearchBar == nil then
Guda_CharDB.settings.showSearchBar = true
end
-- Initialize this character's data
if not Guda_DB.characters[fullName] then
@@ -113,7 +117,7 @@ end
-- Get current player's full name
function DB:GetPlayerFullName()
return playerName .. "-" .. playerRealm
return playerName
end
-- Get current character data
+51 -1
View File
@@ -84,6 +84,11 @@ function Guda_BagFrame_OnShow(self)
BagFrame:UpdateBorderVisibility()
end
-- Apply search bar visibility setting
if BagFrame.UpdateSearchBarVisibility then
BagFrame:UpdateSearchBarVisibility()
end
BagFrame:Update()
end
@@ -328,7 +333,26 @@ function BagFrame:ResizeFrame(currentRow, currentCol, columns)
local containerWidth = (columns * (buttonSize + spacing)) + 20
local containerHeight = (totalRows * (buttonSize + spacing)) + 20
local frameWidth = containerWidth + 20
local frameHeight = containerHeight + 115 -- Title (40) + search (30) + footer (45)
-- Check if search bar is visible
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
if showSearchBar == nil then
showSearchBar = true
end
-- Adjust frame height based on search bar visibility
-- Footer height varies: more space needed when search bar is visible
local titleHeight = 40
local searchBarHeight = 30
local footerHeight
local frameHeight
if showSearchBar then
footerHeight = 55 -- Increased footer height when search bar is visible (toolbar 40px + spacing 15px)
frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight -- 125 total
else
footerHeight = 45 -- Normal footer height (toolbar 40px + spacing 5px)
frameHeight = containerHeight + titleHeight + footerHeight -- 85 total
end
-- Minimum sizes
if containerWidth < 200 then
@@ -1457,6 +1481,32 @@ function BagFrame:UpdateBorderVisibility()
end
end
-- Update search bar visibility based on setting
function BagFrame:UpdateSearchBarVisibility()
if not addon or not addon.Modules or not addon.Modules.DB then return end
local searchBar = getglobal("Guda_BagFrame_SearchBar")
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
if not searchBar or not itemContainer then return end
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
if showSearchBar == nil then
showSearchBar = true
end
if showSearchBar then
searchBar:Show()
-- Anchor ItemContainer to SearchBar's bottom
itemContainer:ClearAllPoints()
itemContainer:SetPoint("TOP", searchBar, "BOTTOM", 0, -5)
else
searchBar:Hide()
-- Anchor ItemContainer directly to frame top (skip search bar space)
itemContainer:ClearAllPoints()
itemContainer:SetPoint("TOP", "Guda_BagFrame", "TOP", 0, -40)
end
end
-- Bag Slot Button Handlers
-- OnLoad handler for bag slot buttons
+4 -4
View File
@@ -49,7 +49,7 @@
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-10" y="-10"/>
<AbsDimension x="-13" y="-10"/>
</Offset>
</Anchor>
</Anchors>
@@ -252,12 +252,12 @@
<!-- Toolbar Container (for money tooltip and bag slots) -->
<Frame name="$parent_Toolbar" enableMouse="true">
<Size>
<AbsDimension x="200" y="30"/>
<AbsDimension x="200" y="40"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="10" y="10"/>
<AbsDimension x="10" y="5"/>
</Offset>
</Anchor>
</Anchors>
@@ -625,7 +625,7 @@
<Size x="180" y="35"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="Guda_BagFrame" relativePoint="BOTTOMRIGHT">
<Offset x="-15" y="10"/>
<Offset x="-15" y="7"/>
</Anchor>
</Anchors>
<Scripts>
+58 -4
View File
@@ -39,6 +39,11 @@ function Guda_BankFrame_OnShow(self)
BankFrame:UpdateBorderVisibility()
end
-- Apply search bar visibility setting
if BankFrame.UpdateSearchBarVisibility then
BankFrame:UpdateSearchBarVisibility()
end
BankFrame:Update()
end
@@ -143,7 +148,7 @@ end
-- Display items
function BankFrame:DisplayItems(bankData, isOtherChar, charName)
local x, y = 10, -10
local x, y = 5, -10
local row = 0
local col = 0
local buttonSize = addon.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
@@ -225,10 +230,27 @@ function BankFrame:ResizeFrame(currentRow, currentCol, columns)
end
-- Calculate required dimensions
local containerWidth = (columns * (buttonSize + spacing)) + 20
local containerWidth = (columns * (buttonSize + spacing)) + 10
local containerHeight = (totalRows * (buttonSize + spacing)) + 20
local frameWidth = containerWidth + 30
local frameHeight = containerHeight + 100 -- Title (40) + search (30) + footer (30)
-- Check if search bar is visible
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
if showSearchBar == nil then
showSearchBar = true
end
-- Adjust frame height based on search bar visibility
-- Footer height varies: less space when search bar is hidden
local titleHeight = 40
local searchBarHeight = 30
local footerHeight = 40
local frameHeight
if showSearchBar then
frameHeight = containerHeight + titleHeight + searchBarHeight + footerHeight -- 125 total
else
frameHeight = containerHeight + titleHeight + footerHeight -- 80 total
end
-- Minimum sizes
if containerWidth < 200 then
@@ -266,6 +288,12 @@ function BankFrame:ResizeFrame(currentRow, currentCol, columns)
itemContainer:SetWidth(containerWidth)
itemContainer:SetHeight(containerHeight)
end
-- Resize search bar to match container width
local searchBar = getglobal("Guda_BankFrame_SearchBar")
if searchBar then
searchBar:SetWidth(containerWidth)
end
end
-- Update bank slots info text
@@ -334,7 +362,7 @@ end
-- Create MoneyFrame if it doesn't exist
function BankFrame:CreateMoneyFrame()
local moneyFrame = CreateFrame("Frame", "Guda_BankFrame_MoneyFrame", Guda_BankFrame, "SmallMoneyFrameTemplate")
moneyFrame:SetPoint("BOTTOMRIGHT", Guda_BankFrame, "BOTTOMRIGHT", -15, 7)
moneyFrame:SetPoint("BOTTOMRIGHT", Guda_BankFrame, "BOTTOMRIGHT", -10, 10)
moneyFrame:SetWidth(180)
moneyFrame:SetHeight(35)
@@ -776,6 +804,32 @@ function BankFrame:UpdateBorderVisibility()
end
end
-- Update search bar visibility based on setting
function BankFrame:UpdateSearchBarVisibility()
if not addon or not addon.Modules or not addon.Modules.DB then return end
local searchBar = getglobal("Guda_BankFrame_SearchBar")
local itemContainer = getglobal("Guda_BankFrame_ItemContainer")
if not searchBar or not itemContainer then return end
local showSearchBar = addon.Modules.DB:GetSetting("showSearchBar")
if showSearchBar == nil then
showSearchBar = true
end
if showSearchBar then
searchBar:Show()
-- Anchor ItemContainer to SearchBar's bottom
itemContainer:ClearAllPoints()
itemContainer:SetPoint("TOP", searchBar, "BOTTOM", 0, -5)
else
searchBar:Hide()
-- Anchor ItemContainer directly to frame top (skip search bar space)
itemContainer:ClearAllPoints()
itemContainer:SetPoint("TOP", "Guda_BankFrame", "TOP", 0, -40)
end
end
-- Initialize
function BankFrame:Initialize()
-- Hide Blizzard bank frame on load (pfUI style)
+4 -4
View File
@@ -49,7 +49,7 @@
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="-10" y="-10"/>
<AbsDimension x="-16" y="-10"/>
</Offset>
</Anchor>
</Anchors>
@@ -163,7 +163,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="13" y="-15"/>
<AbsDimension x="20" y="-15"/>
</Offset>
</Anchor>
</Anchors>
@@ -311,7 +311,7 @@
<!-- Toolbar Container (for bank slots info) -->
<Frame name="$parent_Toolbar" enableMouse="true">
<Size>
<AbsDimension x="200" y="30"/>
<AbsDimension x="200" y="40"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT">
@@ -339,7 +339,7 @@
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="0" y="5"/>
<AbsDimension x="8" y="2"/>
</Offset>
</Anchor>
</Anchors>
+64 -1
View File
@@ -50,6 +50,10 @@ function Guda_SettingsPopup_OnShow(self)
if showQualityBorderOther == nil then
showQualityBorderOther = true
end
local showSearchBar = Guda.Modules.DB:GetSetting("showSearchBar")
if showSearchBar == nil then
showSearchBar = true
end
-- Update sliders and checkboxes
local bagSlider = getglobal("Guda_SettingsPopup_BagColumnsSlider")
@@ -61,6 +65,7 @@ function Guda_SettingsPopup_OnShow(self)
local hideBordersCheckbox = getglobal("Guda_SettingsPopup_HideBordersCheckbox")
local qualityBorderEquipmentCheckbox = getglobal("Guda_SettingsPopup_QualityBorderEquipmentCheckbox")
local qualityBorderOtherCheckbox = getglobal("Guda_SettingsPopup_QualityBorderOtherCheckbox")
local showSearchBarCheckbox = getglobal("Guda_SettingsPopup_ShowSearchBarCheckbox")
if bagSlider then
bagSlider:SetValue(bagColumns)
@@ -97,6 +102,10 @@ function Guda_SettingsPopup_OnShow(self)
if qualityBorderOtherCheckbox then
qualityBorderOtherCheckbox:SetChecked(showQualityBorderOther and 1 or 0)
end
if showSearchBarCheckbox then
showSearchBarCheckbox:SetChecked(showSearchBar and 1 or 0)
end
end
-- Toggle visibility
@@ -353,7 +362,7 @@ end
function Guda_SettingsPopup_HideBordersCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
if text then
text:SetText("Frame Borders")
text:SetText("Hide Frame Borders")
-- Increase font size
local font, _, flags = text:GetFont()
@@ -492,6 +501,60 @@ function Guda_SettingsPopup_QualityBorderOtherCheckbox_OnClick(self)
end
end
-- Show Search Bar Checkbox OnLoad
function Guda_SettingsPopup_ShowSearchBarCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
if text then
text:SetText("Show Search Bar")
-- Increase font size
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 13, flags)
end
end
local showSearchBar = true
if Guda and Guda.Modules and Guda.Modules.DB then
showSearchBar = Guda.Modules.DB:GetSetting("showSearchBar")
if showSearchBar == nil then
showSearchBar = true
end
end
self:SetChecked(showSearchBar and 1 or 0)
end
-- Show Search Bar Checkbox OnClick
function Guda_SettingsPopup_ShowSearchBarCheckbox_OnClick(self)
local isChecked = self:GetChecked() == 1
-- Save setting
if Guda and Guda.Modules and Guda.Modules.DB then
Guda.Modules.DB:SetSetting("showSearchBar", isChecked)
end
-- Update search bar visibility in bag frame
local bagFrame = getglobal("Guda_BagFrame")
if bagFrame and bagFrame:IsShown() then
-- Use the UpdateSearchBarVisibility function which handles anchoring
if Guda.Modules.BagFrame.UpdateSearchBarVisibility then
Guda.Modules.BagFrame:UpdateSearchBarVisibility()
end
Guda.Modules.BagFrame:Update()
end
-- Update search bar visibility in bank frame
local bankFrame = getglobal("Guda_BankFrame")
if bankFrame and bankFrame:IsShown() then
-- Use the UpdateSearchBarVisibility function which handles anchoring
if Guda.Modules.BankFrame.UpdateSearchBarVisibility then
Guda.Modules.BankFrame:UpdateSearchBarVisibility()
end
Guda.Modules.BankFrame:Update()
end
end
-- Initialize
function SettingsPopup:Initialize()
Guda:Debug("Settings popup initialized")
+20 -1
View File
@@ -3,7 +3,7 @@
<!-- Settings Popup Frame -->
<Frame name="Guda_SettingsPopup" toplevel="true" movable="true" enableMouse="true" hidden="true" parent="UIParent" frameStrata="DIALOG">
<Size>
<AbsDimension x="420" y="480"/>
<AbsDimension x="420" y="500"/>
</Size>
<Anchors>
@@ -245,6 +245,25 @@
</OnClick>
</Scripts>
</CheckButton>
<!-- Show Search Bar Checkbox -->
<CheckButton name="$parent_ShowSearchBarCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_QualityBorderEquipmentCheckbox">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_ShowSearchBarCheckbox_OnLoad(this)
</OnLoad>
<OnClick>
Guda_SettingsPopup_ShowSearchBarCheckbox_OnClick(this)
</OnClick>
</Scripts>
</CheckButton>
</Frames>
<Scripts>