Skip to content

Commit

Permalink
Update Styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Apr 14, 2024
1 parent cc0b0e3 commit 74dfe38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 5 additions & 8 deletions KkthnxUI/Modules/Blizzard/Elements/MirrorBars.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
local K, C = KkthnxUI[1], KkthnxUI[2]
local Module = K:GetModule("Blizzard")

-- Sourced: NDui

local function SetupMirrorBar(bar)
-- local statusBar = bar.StatusBar
local function StyleMirrorBar(bar)
local statusbar = bar.StatusBar or _G[bar:GetName() .. "StatusBar"]
if statusbar then
statusbar:SetAllPoints()
Expand All @@ -13,7 +10,6 @@ local function SetupMirrorBar(bar)
end

local text = bar.Text
local spark = bar.Spark

bar:SetSize(222, 22)
bar:StripTextures(true)
Expand All @@ -23,21 +19,22 @@ local function SetupMirrorBar(bar)
text:SetFont(text:GetFont(), 12, nil)
text:SetPoint("BOTTOM", bar, "TOP", 0, 4)

spark = bar:CreateTexture(nil, "OVERLAY")
local spark = bar:CreateTexture(nil, "OVERLAY")
spark:SetSize(64, bar:GetHeight())
spark:SetTexture(C["Media"].Textures.Spark128Texture)
spark:SetBlendMode("ADD")
spark:SetPoint("CENTER", statusbar:GetStatusBarTexture(), "RIGHT", 0, 0)

bar:CreateBorder()

bar.styled = true -- set styled flag on the bar
end

function Module:CreateMirrorBars()
hooksecurefunc(MirrorTimerContainer, "SetupTimer", function(self, timer)
local bar = self:GetAvailableTimer(timer)
if not bar.styled then
SetupMirrorBar(bar)
bar.styled = true
StyleMirrorBar(bar)
end
end)
end
6 changes: 2 additions & 4 deletions KkthnxUI/Modules/Blizzard/Elements/TimerTracker.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
local K, C = KkthnxUI[1], KkthnxUI[2]
local Module = K:GetModule("Blizzard")

-- Sourced: NDui

local pairs = pairs

local function SetupTimerTracker(bar)
local function StyleTimerBar(bar)
local texture = K.GetTexture(C["General"].Texture)

bar:SetSize(222, 22)
Expand All @@ -27,7 +25,7 @@ function Module:CreateTimerTracker()
local function UpdateTimerTracker()
for _, timer in pairs(_G.TimerTracker.timerList) do
if timer.bar and not timer.bar.styled then -- only apply style if not styled before
SetupTimerTracker(timer.bar)
StyleTimerBar(timer.bar)
end
end
end
Expand Down

0 comments on commit 74dfe38

Please sign in to comment.