Skip to content

Commit

Permalink
fix: colored header hover highlight (#7)
Browse files Browse the repository at this point in the history
Fix to headers colored by `GBB.DB.ColorOnLevel` not being affected by the highlight font object.
  • Loading branch information
juemrami authored May 22, 2024
1 parent 8f0912f commit 19cc801
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion LFGBulletinBoard/RequestList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ local function CreateHeader(scrollPos, dungeon)
local padY = 4 -- px, vspace around text
local bottomMargin = 3 -- px, vspace beneath the header
if not header then
---@class requestHeader : Frame
---@class RequestHeader : Frame
header = CreateFrame(
"Frame", ItemFrameName,
GroupBulletinBoardFrame_ScrollChildFrame, "GroupBulletinBoard_TmpHeader"
Expand All @@ -108,9 +108,23 @@ local function CreateHeader(scrollPos, dungeon)
GameFontNormalLarge = "GameFontHighlightLarge",
}
header:SetScript("OnEnter", function(self)
---@cast self RequestHeader
if GBB.DB.ColorOnLevel then
-- save color esacped text
self.Name.savedText = self.Name:GetText()
local name, levels = self.Name.savedText:match("|c%x%x%x%x%x%x%x%x(.+)|r(.+)");
if name then
self.Name:SetText(name..(levels or ""))
end
end
self.Name:SetFontObject(matchedHighlight[GBB.DB.FontSize or "GameFontNormal"])
end)
header:SetScript("OnLeave", function(self)
---@cast self RequestHeader
if GBB.DB.ColorOnLevel then
-- restore color escaped text
self.Name:SetText(self.Name.savedText)
end
self.Name:SetFontObject(GBB.DB.FontSize or "GameFontNormal")
end)

Expand Down

0 comments on commit 19cc801

Please sign in to comment.