Skip to content

Commit 70bdf22

Browse files
extendedplates: add vertical functionality for cdtracker
1 parent b55e847 commit 70bdf22

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

extendedplates/tracktarget.lua

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ local cdt = {
260260
recordButton = nil,
261261
showButton = nil,
262262
lockButton = nil,
263+
orientationButton = nil,
263264
trackedTitleLabel = nil,
264265
window = nil,
265266
background = nil,
@@ -279,6 +280,7 @@ local cdt = {
279280
timerIconSize = 28,
280281
timerFontSize = 13,
281282
timerSpacing = 0,
283+
timerVertical = false,
282284
hasWindowPos = false,
283285
previewTimers = {
284286
{ icon = "ui/icon/icon_skill_will05.dds", text = "45" },
@@ -572,6 +574,7 @@ function cdt.SaveSettings()
572574
timerIconSize = cdt.timerIconSize,
573575
timerFontSize = cdt.timerFontSize,
574576
timerSpacing = cdt.timerSpacing,
577+
timerVertical = cdt.timerVertical,
575578
tracked = tracked,
576579
})
577580
end
@@ -593,6 +596,9 @@ function cdt.LoadSettings()
593596
if stored.lockWindow ~= nil then
594597
cdt.lockWindow = stored.lockWindow and true or false
595598
end
599+
if stored.timerVertical ~= nil then
600+
cdt.timerVertical = stored.timerVertical and true or false
601+
end
596602
if tonumber(stored.timerIconSize) ~= nil then
597603
cdt.timerIconSize = math.max(16, math.min(64, math.floor(tonumber(stored.timerIconSize))))
598604
end
@@ -676,12 +682,21 @@ function cdt.ApplyTimerLayout()
676682

677683
local count = #cdt.timerRows
678684
local width = 8 + (count * size) + (math.max(0, count - 1) * spacing)
679-
cdt.window:SetExtent(width, size + 6)
685+
local height = size + 6
686+
if cdt.timerVertical then
687+
width = size + 8
688+
height = 6 + (count * size) + (math.max(0, count - 1) * spacing)
689+
end
690+
cdt.window:SetExtent(width, height)
680691
for i = 1, count do
681692
local row = cdt.timerRows[i]
682693
row:SetExtent(size, size)
683694
row:RemoveAllAnchors()
684-
row:AddAnchor("TOPLEFT", cdt.window, 4 + ((i - 1) * (size + spacing)), 3)
695+
if cdt.timerVertical then
696+
row:AddAnchor("TOPLEFT", cdt.window, 4, 3 + ((i - 1) * (size + spacing)))
697+
else
698+
row:AddAnchor("TOPLEFT", cdt.window, 4 + ((i - 1) * (size + spacing)), 3)
699+
end
685700
row.icon:SetExtent(size, size)
686701
row.icon:RemoveAllAnchors()
687702
row.icon:AddAnchor("CENTER", row, 0, 0)
@@ -3282,6 +3297,9 @@ function cdt.RefreshSettingsWindow()
32823297
if cdt.lockButton ~= nil then
32833298
cdt.lockButton:SetText("Lock Timer [" .. (cdt.lockWindow and "ON" or "OFF") .. "]")
32843299
end
3300+
if cdt.orientationButton ~= nil then
3301+
cdt.orientationButton:SetText(cdt.timerVertical and "Vertical" or "Horizontal")
3302+
end
32853303
if cdt.trackedTitleLabel ~= nil then
32863304
local totalTracked = #cdt.tracked
32873305
local visibleCount = #cdt.trackedRows
@@ -3576,6 +3594,17 @@ do
35763594
clearCooldownsButton:SetHandler("OnClick", function()
35773595
cdt.ClearSavedCooldowns()
35783596
end)
3597+
cdt.orientationButton = cdt.settingsWindow:CreateChildWidget("button", "timerOrientationButton", 0, true)
3598+
ApplyLocalButtonStyle(cdt.orientationButton)
3599+
cdt.orientationButton:SetExtent(124, 24)
3600+
cdt.orientationButton:AddAnchor("TOPLEFT", cdt.settingsWindow, 284, 112)
3601+
cdt.orientationButton:SetHandler("OnClick", function()
3602+
cdt.timerVertical = not cdt.timerVertical
3603+
cdt.ApplyTimerLayout()
3604+
cdt.SaveSettings()
3605+
cdt.RefreshSettingsWindow()
3606+
cdt.RefreshTimerWindow()
3607+
end)
35793608

35803609
local recentTitle = cdt.settingsWindow:CreateChildWidget("label", "recentTitle", 0, true)
35813610
recentTitle:AddAnchor("TOPLEFT", cdt.settingsWindow, 16, 146)

0 commit comments

Comments
 (0)