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
+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>