Skip to content

Commit 52049b4

Browse files
committed
fix: fix rematch top bar buttons
1 parent b088449 commit 52049b4

File tree

1 file changed

+69
-54
lines changed

1 file changed

+69
-54
lines changed

Modules/Skins/Addons/Rematch.lua

Lines changed: 69 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,63 @@ local function ReskinToggleButton(button)
113113
button.__windSkin = true
114114
end
115115

116+
local texList = {
117+
close = { E.Media.Textures.Close, 0 },
118+
minimize = { E.Media.Textures.ArrowUp, ES.ArrowRotation.up },
119+
maximize = { E.Media.Textures.ArrowUp, ES.ArrowRotation.down },
120+
left = { E.Media.Textures.ArrowUp, ES.ArrowRotation.left },
121+
right = { E.Media.Textures.ArrowUp, ES.ArrowRotation.right },
122+
pin = { W.Media.Icons.buttonPin, 0 },
123+
lock = { W.Media.Icons.buttonLock, 0 },
124+
unlock = { W.Media.Icons.buttonUnlock, 0 },
125+
flip = { W.Media.Icons.buttonUndo, 0 },
126+
}
127+
128+
---@param frame Button?
129+
---@param size number?
130+
local function ReskinTitlebarButton(frame, size)
131+
if not frame or frame.__windSkin then
132+
return
133+
end
134+
135+
---@param tex Texture
136+
---@param r number?
137+
---@param g number?
138+
---@param b number?
139+
local function UpdateTexture(tex, r, g, b)
140+
if not frame.icon or not texList[frame.icon] then
141+
return
142+
end
143+
local texData = texList[frame.icon]
144+
145+
tex:SetTexture(texData[1])
146+
tex:SetRotation(texData[2] or 0)
147+
tex:SetTexCoord(0, 1, 0, 1)
148+
tex:Size(size or 12)
149+
tex:SetVertexColor(r or 1, g or 1, b or 1)
150+
tex:SetAlpha(1)
151+
tex:SetBlendMode("BLEND")
152+
153+
F.InternalizeMethod(tex, "SetTexture", true)
154+
F.InternalizeMethod(tex, "SetTexCoord", true)
155+
end
156+
157+
local hoverColor = E.media.rgbvaluecolor
158+
159+
frame.Update = function(self)
160+
UpdateTexture(self:GetNormalTexture(), 1, 1, 1)
161+
UpdateTexture(self:GetDisabledTexture(), 0.5, 0.5, 0.5)
162+
UpdateTexture(self:GetPushedTexture(), hoverColor.r, hoverColor.g, hoverColor.b)
163+
UpdateTexture(self:GetHighlightTexture(), hoverColor.r, hoverColor.g, hoverColor.b)
164+
end
165+
166+
frame:Update()
167+
168+
frame:Size(size or 12, size or 12)
169+
170+
frame.__windSkin = true
171+
end
172+
116173
local function ReskinCardStatusBar(parent, key)
117174
if not parent or not key or not parent[key] or parent[key].__windSkin then
118175
return
@@ -280,7 +337,18 @@ local function ReskinTitleBar(frame)
280337

281338
frame.Portrait:Kill()
282339
F.SetFontOutline(frame.Title)
283-
S:Proxy("HandleCloseButton", frame.CloseButton)
340+
341+
ReskinTitlebarButton(frame.CloseButton)
342+
F.Move(frame.CloseButton, -4, -4)
343+
ReskinTitlebarButton(frame.MinimizeButton, 16)
344+
F.Move(frame.MinimizeButton, -4, 2)
345+
346+
ReskinTitlebarButton(frame.LockButton, 14)
347+
F.Move(frame.LockButton, 4, -4)
348+
ReskinTitlebarButton(frame.NextModeButton, 14)
349+
F.Move(frame.NextModeButton, 4, 0)
350+
ReskinTitlebarButton(frame.PrevModeButton, 14)
351+
F.Move(frame.PrevModeButton, 4, 0)
284352
end
285353

286354
local function ReskinToolBar(frame)
@@ -849,59 +917,6 @@ local function ReskinOptionsPanel(frame)
849917
frame.List.ScrollBox:ForEachFrame(ReskinListElement)
850918
end
851919

852-
local texList = {
853-
close = { E.Media.Textures.Close, 0 },
854-
minimize = { E.Media.Textures.ArrowUp, ES.ArrowRotation.up },
855-
maximize = { E.Media.Textures.ArrowUp, ES.ArrowRotation.down },
856-
left = { E.Media.Textures.ArrowUp, ES.ArrowRotation.left },
857-
right = { E.Media.Textures.ArrowUp, ES.ArrowRotation.right },
858-
pin = { W.Media.Icons.buttonPin, 0 },
859-
lock = { W.Media.Icons.buttonLock, 0 },
860-
unlock = { W.Media.Icons.buttonUnlock, 0 },
861-
flip = { W.Media.Icons.buttonUndo, 0 },
862-
}
863-
864-
---@param frame Button?
865-
---@param size number?
866-
local function ReskinTitlebarButton(frame, size)
867-
if not frame or frame.__windSkin then
868-
return
869-
end
870-
871-
---@param tex Texture
872-
---@param r number?
873-
---@param g number?
874-
---@param b number?
875-
local function UpdateTexture(tex, r, g, b)
876-
if not frame.icon or not texList[frame.icon] then
877-
return
878-
end
879-
880-
tex:SetTexture(texList[frame.icon][1])
881-
tex:SetRotation(texList[frame.icon][2] or 0)
882-
tex:SetTexCoord(0, 1, 0, 1)
883-
tex:Size(size or 12, size or 12)
884-
tex:SetVertexColor(r or 1, g or 1, b or 1)
885-
tex:SetAlpha(1)
886-
tex:SetBlendMode("DISABLE")
887-
end
888-
889-
local hoverColor = E.media.rgbvaluecolor
890-
891-
frame.Update = function(self)
892-
UpdateTexture(self:GetNormalTexture(), 1, 1, 1)
893-
UpdateTexture(self:GetDisabledTexture(), 0.5, 0.5, 0.5)
894-
UpdateTexture(self:GetPushedTexture(), hoverColor.r, hoverColor.g, hoverColor.b)
895-
UpdateTexture(self:GetHighlightTexture(), hoverColor.r, hoverColor.g, hoverColor.b)
896-
end
897-
898-
frame:Update()
899-
900-
frame:Size(size or 12, size or 12)
901-
902-
frame.__windSkin = true
903-
end
904-
905920
local function ReskinRoundButton(frame)
906921
for _, tex in pairs({ frame:GetRegions() }) do
907922
if tex:IsObjectType("Texture") and tex:GetDrawLayer() == "ARTWORK" then

0 commit comments

Comments
 (0)