Skip to content

Commit 8c289dd

Browse files
committed
feat: use the rude way to run the set tex coord
1 parent 78c6933 commit 8c289dd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Modules/Maps/MinimapButtons.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ local unpack = unpack
2121
local CreateFrame = CreateFrame
2222
local InCombatLockdown = InCombatLockdown
2323
local RegisterStateDriver = RegisterStateDriver
24-
local RunNextFrame = RunNextFrame
2524
local UnregisterStateDriver = UnregisterStateDriver
2625

2726
local C_AddOns_IsAddOnLoaded = C_AddOns.IsAddOnLoaded
@@ -143,22 +142,24 @@ function MB:HandleLibDBIconButton(button, name)
143142

144143
self:SecureHook(button, "SetShown", "OnButtonSetShown")
145144

146-
if button.icon and not self:IsHooked(button.icon, "SetTexCoord") then
147-
self:SecureHook(button.icon, "SetTexCoord", function(_, ...)
145+
if button.icon and button.icon.SetTexCoord and not self:IsHooked(button.icon, "SetTexCoord") then
146+
self:RawHook(button.icon, "SetTexCoord", function(icon, ...)
148147
local arg1, arg2, arg3, arg4 = ...
149148
if
150149
F.IsAlmost(arg1, 0.05)
151150
and F.IsAlmost(arg2, 0.95)
152151
and F.IsAlmost(arg3, 0.05)
153152
and F.IsAlmost(arg4, 0.95)
154153
then
155-
button.icon:SetTexCoord(unpack(E.TexCoords))
154+
return self.hooks[icon].SetTexCoord(icon, unpack(E.TexCoords))
156155
end
157156

158157
if F.IsAlmost(arg1, 0) and F.IsAlmost(arg2, 1) and F.IsAlmost(arg3, 0) and F.IsAlmost(arg4, 1) then
159-
button.icon:SetTexCoord(unpack(E.TexCoords))
158+
return self.hooks[icon].SetTexCoord(icon, unpack(E.TexCoords))
160159
end
161-
end)
160+
161+
return self.hooks[icon].SetTexCoord(icon, ...)
162+
end, true)
162163
end
163164

164165
return button:IsShown()

0 commit comments

Comments
 (0)