Skip to content

Commit cc78c62

Browse files
committed
fix: fix the aurabar icon crop
1 parent feb817b commit cc78c62

File tree

1 file changed

+13
-40
lines changed

1 file changed

+13
-40
lines changed

Modules/Skins/Addons/WeakAuras.lua

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,21 @@ local WeakAuras = _G.WeakAuras
1010

1111
---Create backdrop and shadow for a frame with common settings
1212
---@param frame Frame The frame to apply backdrop and shadow to
13-
---@param useDefaultTemplate boolean? Whether to use default template
14-
local function CreateBackdropAndShadow(frame, useDefaultTemplate)
13+
local function CreateBackdropAndShadow(frame)
1514
if not frame or frame.__windBackdrop then
1615
return
1716
end
1817

19-
frame:CreateBackdrop(not useDefaultTemplate and "Transparent")
18+
frame.customBackdropAlpha = 0
19+
frame:CreateBackdrop("Transparent")
2020

2121
if E.private.WT.skins.weakAurasShadow then
2222
S:CreateBackdropShadow(frame, true)
2323
end
2424

25-
frame.backdrop.Center:StripTextures()
2625
frame.__windBackdrop = true
2726
end
2827

29-
---Apply ElvUI texture coordinates to an icon
30-
---@param icon Texture The icon texture to apply coordinates to
31-
local function ApplyElvUITexCoords(icon)
32-
if not icon then
33-
return
34-
end
35-
36-
F.InternalizeMethod(icon, "SetTexCoord")
37-
F.CallMethod(icon, "SetTexCoord", unpack(E.TexCoords))
38-
end
39-
4028
---Handle complex texture coordinate calculations for icons
4129
---@param icon Texture The icon texture to handle
4230
local function HandleComplexTexCoords(icon)
@@ -46,11 +34,9 @@ local function HandleComplexTexCoords(icon)
4634

4735
F.InternalizeMethod(icon, "SetTexCoord")
4836
icon.SetTexCoord = function(self, ULx, ULy, LLx, LLy, URx, URy, LRx, LRy)
49-
local cLeft, cRight, cTop, cDown
37+
local cLeft, cRight, cTop, cDown = ULx, ULy, LLx, LLy
5038
if URx and URy and LRx and LRy then
5139
cLeft, cRight, cTop, cDown = ULx, LRx, ULy, LRy
52-
else
53-
cLeft, cRight, cTop, cDown = ULx, ULy, LLx, LLy
5440
end
5541

5642
local left, right, top, down = unpack(E.TexCoords)
@@ -88,44 +74,29 @@ local function SyncBackdropAlpha(frame, icon)
8874

8975
frame.backdrop.icon = icon
9076
frame.backdrop:HookScript("OnUpdate", function(self)
91-
self:SetAlpha(self.icon:GetAlpha())
77+
local alpha = self.icon:GetAlpha()
78+
self:SetAlpha(alpha)
9279
if self.shadow then
93-
self.shadow:SetAlpha(self.icon:GetAlpha())
80+
self.shadow:SetAlpha(alpha)
9481
end
9582
end)
9683
end
9784

9885
---Skin an icon region
9986
---@param frame Frame The icon frame to skin
10087
local function SkinIconRegion(frame)
101-
if not frame or frame.__windSkin then
102-
return
103-
end
104-
10588
if frame.icon then
10689
HandleComplexTexCoords(frame.icon)
107-
end
108-
109-
CreateBackdropAndShadow(frame)
110-
111-
if frame.icon then
11290
SyncBackdropAlpha(frame, frame.icon)
11391
end
114-
115-
frame.__windSkin = true
11692
end
11793

11894
---Skin an aurabar region
11995
---@param frame Frame The aurabar frame to skin
12096
local function SkinAurabarRegion(frame)
121-
if not frame or frame.__windSkin then
122-
return
123-
end
124-
125-
CreateBackdropAndShadow(frame)
126-
12797
if frame.icon then
128-
ApplyElvUITexCoords(frame.icon)
98+
F.InternalizeMethod(frame.icon, "SetTexCoord", true)
99+
F.CallMethod(frame.icon, "SetTexCoord", unpack(E.TexCoords))
129100
end
130101

131102
if frame.iconFrame then
@@ -141,8 +112,6 @@ local function SkinAurabarRegion(frame)
141112
frame.iconFrame.backdrop:SetShown(true)
142113
end)
143114
end
144-
145-
frame.__windSkin = true
146115
end
147116

148117
---Main function to skin WeakAuras regions
@@ -153,11 +122,15 @@ local function SkinWeakAuras(frame, regionType)
153122
return
154123
end
155124

125+
CreateBackdropAndShadow(frame)
126+
156127
if regionType == "icon" then
157128
SkinIconRegion(frame)
158129
elseif regionType == "aurabar" then
159130
SkinAurabarRegion(frame)
160131
end
132+
133+
frame.__windSkin = true
161134
end
162135

163136
function S:WeakAuras()

0 commit comments

Comments
 (0)