fix: background transparency

This commit is contained in:
Salikh Gurgenidze
2025-12-21 21:15:44 +04:00
parent 0afaec6dfa
commit de9ac33ad7
9 changed files with 138 additions and 15 deletions
+9
View File
@@ -44,11 +44,20 @@ function DB:Initialize()
showSearchBar = true,
hoverBagline = false,
hideFooter = false,
bgTransparency = 0.15,
},
}
end
-- Ensure new settings exist for existing installations
if Guda_CharDB.settings.bgTransparency == nil then
if Guda_CharDB.settings.frameOpacity ~= nil then
Guda_CharDB.settings.bgTransparency = 1.0 - Guda_CharDB.settings.frameOpacity
Guda_CharDB.settings.frameOpacity = nil -- Clean up old setting
else
Guda_CharDB.settings.bgTransparency = 0.15
end
end
if Guda_CharDB.settings.hideFooter == nil then
Guda_CharDB.settings.hideFooter = false
end
+18 -7
View File
@@ -57,27 +57,27 @@ addon.Constants = {
Backdrops = {
-- Standard frame backdrop (used for main windows)
DEFAULT_FRAME = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
tileSize = 16,
edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11 }
},
-- Minimalist border (used when "hide borders" setting is enabled)
MINIMALIST_BORDER = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 32,
tileSize = 16,
edgeSize = 2,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
},
-- Dropdown/popup backdrop (used for character selection dropdowns)
DROPDOWN = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 16,
@@ -88,7 +88,7 @@ addon.Constants = {
-- Backdrop colors (common configurations)
BackdropColors = {
DEFAULT = {r = 0, g = 0, b = 0, a = 0.9},
DEFAULT = {r = 0, g = 0, b = 0, a = 0.85},
DROPDOWN = {r = 0, g = 0, b = 0, a = 0.95},
},
}
@@ -196,7 +196,18 @@ function addon:ApplyBackdrop(frame, backdropType, colorType)
end
frame:SetBackdrop(backdrop)
frame:SetBackdropColor(color.r, color.g, color.b, color.a)
-- If it's a main frame, we should respect the transparency setting
local frameName = frame:GetName()
if frameName == "Guda_BagFrame" or frameName == "Guda_BankFrame" or frameName == "Guda_SettingsPopup" or frameName == "Guda_QuestItemBar" then
if Guda_ApplyBackgroundTransparency then
Guda_ApplyBackgroundTransparency()
else
frame:SetBackdropColor(color.r, color.g, color.b, color.a)
end
else
frame:SetBackdropColor(color.r, color.g, color.b, color.a)
end
-- Set border color to white for minimalist borders
if backdropType == "MINIMALIST_BORDER" then
+5
View File
@@ -43,6 +43,11 @@ function Main:Initialize()
addon.Modules.SettingsPopup:Initialize()
-- Apply initial transparency settings
if Guda_ApplyBackgroundTransparency then
Guda_ApplyBackgroundTransparency()
end
-- Initialize tooltip
if addon.Modules.Tooltip then
addon.Modules.Tooltip:Initialize()
+8
View File
@@ -38,6 +38,9 @@ end
-- OnLoad
function Guda_BagFrame_OnLoad(self)
-- Set up initial backdrop
addon:ApplyBackdrop(self, "DEFAULT_FRAME")
-- Set up search box placeholder
local searchBox = getglobal(self:GetName().."_SearchBar_SearchBox")
if searchBox then
@@ -96,6 +99,11 @@ function Guda_BagFrame_OnShow(self)
BagFrame:UpdateFooterVisibility()
end
-- Apply frame transparency
if Guda_ApplyBackgroundTransparency then
Guda_ApplyBackgroundTransparency()
end
BagFrame:Update()
end
+1 -2
View File
@@ -15,7 +15,7 @@
</Anchor>
</Anchors>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
@@ -25,7 +25,6 @@
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
<Color r="0" g="0" b="0" a="0.9"/>
</Backdrop>
<Layers>
+8
View File
@@ -16,6 +16,9 @@ local bankClickCatcher = nil
-- OnLoad
function Guda_BankFrame_OnLoad(self)
-- Set up initial backdrop
addon:ApplyBackdrop(self, "DEFAULT_FRAME")
-- Set up search box placeholder
local searchBox = getglobal(self:GetName().."_SearchBar_SearchBox")
if searchBox then
@@ -67,6 +70,11 @@ function Guda_BankFrame_OnShow(self)
BankFrame:UpdateFooterVisibility()
end
-- Apply frame transparency
if Guda_ApplyBackgroundTransparency then
Guda_ApplyBackgroundTransparency()
end
BankFrame:Update()
end
+1 -2
View File
@@ -15,7 +15,7 @@
</Anchor>
</Anchors>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
@@ -25,7 +25,6 @@
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
<Color r="0" g="0" b="0" a="0.9"/>
</Backdrop>
<Layers>
+63
View File
@@ -16,6 +16,9 @@ end
-- OnLoad
function Guda_SettingsPopup_OnLoad(self)
-- Set up initial backdrop
Guda:ApplyBackdrop(self, "DEFAULT_FRAME")
local title = getglobal(self:GetName().."_Title")
title:SetText("Guda Settings")
-- Increase title font size
@@ -62,6 +65,7 @@ function Guda_SettingsPopup_OnShow(self)
if hoverBagline == nil then
hoverBagline = false
end
local bgTransparency = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15
-- Update sliders and checkboxes
local bagSlider = getglobal("Guda_SettingsPopup_BagColumnsSlider")
@@ -69,6 +73,7 @@ function Guda_SettingsPopup_OnShow(self)
local iconSizeSlider = getglobal("Guda_SettingsPopup_IconSizeSlider")
local iconFontSizeSlider = getglobal("Guda_SettingsPopup_IconFontSizeSlider")
local iconSpacingSlider = getglobal("Guda_SettingsPopup_IconSpacingSlider")
local bgTransparencySlider = getglobal("Guda_SettingsPopup_BgTransparencySlider")
local lockCheckbox = getglobal("Guda_SettingsPopup_LockBagsCheckbox")
local hideBordersCheckbox = getglobal("Guda_SettingsPopup_HideBordersCheckbox")
local qualityBorderEquipmentCheckbox = getglobal("Guda_SettingsPopup_QualityBorderEquipmentCheckbox")
@@ -97,6 +102,10 @@ function Guda_SettingsPopup_OnShow(self)
iconSpacingSlider:SetValue(iconSpacing)
end
if bgTransparencySlider then
bgTransparencySlider:SetValue(bgTransparency)
end
if lockCheckbox then
lockCheckbox:SetChecked(lockBags and 1 or 0)
end
@@ -220,6 +229,60 @@ function Guda_SettingsPopup_BankColumnsSlider_OnValueChanged(self)
end
end
-- Background Transparency Slider OnLoad
function Guda_SettingsPopup_BgTransparencySlider_OnLoad(self)
getglobal(self:GetName().."Low"):SetText("0%")
getglobal(self:GetName().."High"):SetText("100%")
local text = getglobal(self:GetName().."Text")
text:SetText("Background Transparency")
-- Increase font size
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 12, flags)
end
self:SetMinMaxValues(0.0, 1.0)
self:SetValueStep(0.05)
local currentValue = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15
self:SetValue(currentValue)
end
-- Background Transparency Slider OnValueChanged
function Guda_SettingsPopup_BgTransparencySlider_OnValueChanged(self)
local value = self:GetValue()
-- Round to 2 decimal places
value = math.floor(value * 100 + 0.5) / 100
-- Update display text
getglobal(self:GetName().."Text"):SetText("Background Transparency: " .. math.floor(value * 100) .. "%")
-- Save setting
Guda.Modules.DB:SetSetting("bgTransparency", value)
-- Apply transparency
Guda_ApplyBackgroundTransparency()
end
-- Apply background transparency to bag and bank frames
function Guda_ApplyBackgroundTransparency()
local transparency = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15
local alpha = 1.0 - transparency
local frames = { "Guda_BagFrame", "Guda_BankFrame", "Guda_SettingsPopup", "Guda_QuestItemBar" }
for _, frameName in ipairs(frames) do
local frame = getglobal(frameName)
if frame then
-- Reset frame alpha to 1.0 (previous version might have set it)
frame:SetAlpha(1.0)
-- Set backdrop color (background only)
frame:SetBackdropColor(0, 0, 0, alpha)
end
end
end
-- Icon Size Slider OnLoad
function Guda_SettingsPopup_IconSizeSlider_OnLoad(self)
getglobal(self:GetName().."Low"):SetText("30px")
+25 -4
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="530"/>
<AbsDimension x="420" y="570"/>
</Size>
<Anchors>
@@ -14,7 +14,7 @@
</Anchor>
</Anchors>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
@@ -24,7 +24,6 @@
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
<Color r="0" g="0" b="0" a="0.9"/>
</Backdrop>
<Layers>
@@ -170,10 +169,32 @@
</Scripts>
</Slider>
<!-- Background Transparency Slider -->
<Slider name="$parent_BgTransparencySlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="370" y="17"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_IconSpacingSlider">
<Offset>
<AbsDimension x="0" y="-40"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_BgTransparencySlider_OnLoad(this)
</OnLoad>
<OnValueChanged>
Guda_SettingsPopup_BgTransparencySlider_OnValueChanged(this)
</OnValueChanged>
</Scripts>
</Slider>
<!-- Lock Bags Checkbox -->
<CheckButton name="$parent_LockBagsCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_IconSpacingSlider">
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_BgTransparencySlider">
<Offset>
<AbsDimension x="-170" y="-30"/>
</Offset>