From a93e9f530cabf5c498e53a9826e4d4399250d18d Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:26:48 -0500 Subject: [PATCH] Add spell name & timer text alignment options for unit frame castbars Adds per-unit (player/target/focus) dropdowns to align the castbar spell name (left text) and cast timer (right text) Left/Center/Right. Both share a castbaralign dropdown; defaults preserve current behavior (name LEFT, timer RIGHT). Applied at castbar creation, so takes effect on /reload like the other castbar options. --- api/config.lua | 6 ++++++ env/translations_enUS.lua | 2 ++ modules/castbar.lua | 4 ++-- modules/gui.lua | 11 +++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/api/config.lua b/api/config.lua index 6f03987a..12784df3 100644 --- a/api/config.lua +++ b/api/config.lua @@ -717,6 +717,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("castbar", "player", "mergetradeskill", "1") pfUI:UpdateConfig("castbar", "player", "txtrightoffx", "0") pfUI:UpdateConfig("castbar", "player", "txtrightoffy", "0") + pfUI:UpdateConfig("castbar", "player", "namealign", "LEFT") + pfUI:UpdateConfig("castbar", "player", "timealign", "RIGHT") pfUI:UpdateConfig("castbar", "target", "hide_pfui", "0") pfUI:UpdateConfig("castbar", "target", "width", "-1") pfUI:UpdateConfig("castbar", "target", "height", "-1") @@ -729,6 +731,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("castbar", "target", "showrank", "0") pfUI:UpdateConfig("castbar", "target", "txtrightoffx", "0") pfUI:UpdateConfig("castbar", "target", "txtrightoffy", "0") + pfUI:UpdateConfig("castbar", "target", "namealign", "LEFT") + pfUI:UpdateConfig("castbar", "target", "timealign", "RIGHT") pfUI:UpdateConfig("castbar", "focus", "hide_pfui", "0") pfUI:UpdateConfig("castbar", "focus", "width", "-1") pfUI:UpdateConfig("castbar", "focus", "height", "-1") @@ -741,6 +745,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("castbar", "focus", "showrank", "0") pfUI:UpdateConfig("castbar", "focus", "txtrightoffx", "0") pfUI:UpdateConfig("castbar", "focus", "txtrightoffy", "0") + pfUI:UpdateConfig("castbar", "focus", "namealign", "LEFT") + pfUI:UpdateConfig("castbar", "focus", "timealign", "RIGHT") pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0") pfUI:UpdateConfig("tooltip", nil, "position", "chat") diff --git a/env/translations_enUS.lua b/env/translations_enUS.lua index 0443d0da..300881a4 100644 --- a/env/translations_enUS.lua +++ b/env/translations_enUS.lua @@ -750,6 +750,7 @@ pfUI_translation["enUS"] = { ["Show Totems Indicators"] = nil, ["Shrink & Return"] = nil, ["Size"] = nil, + ["Spell Name Alignment"] = nil, ["Skin"] = nil, ["Skins"] = nil, ["Slow"] = nil, @@ -798,6 +799,7 @@ pfUI_translation["enUS"] = { ["Threshold To Trust Health Estimation"] = nil, ["Time"] = nil, ["Timer"] = nil, + ["Timer Alignment"] = nil, ["Time Remaining"] = nil, ["Timer In Minutes"] = nil, ["Timestamp Brackets"] = nil, diff --git a/modules/castbar.lua b/modules/castbar.lua index 71c76eec..f93274d7 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -193,7 +193,7 @@ pfUI:RegisterModule("castbar", function () cb.bar.left:SetFontObject(GameFontWhite) cb.bar.left:SetTextColor(1,1,1,1) cb.bar.left:SetFont(font, font_size, "OUTLINE") - cb.bar.left:SetJustifyH("left") + cb.bar.left:SetJustifyH(C.castbar[unitstr].namealign or "LEFT") -- text right cb.bar.right = cb.bar:CreateFontString("Status", "DIALOG", "GameFontNormal") @@ -204,7 +204,7 @@ pfUI:RegisterModule("castbar", function () cb.bar.right:SetFontObject(GameFontWhite) cb.bar.right:SetTextColor(1,1,1,1) cb.bar.right:SetFont(font, font_size, "OUTLINE") - cb.bar.right:SetJustifyH("right") + cb.bar.right:SetJustifyH(C.castbar[unitstr].timealign or "RIGHT") cb.bar.lag = cb.bar:CreateTexture(nil, "OVERLAY") cb.bar.lag:SetPoint("TOPRIGHT", cb.bar, "TOPRIGHT", 0, 0) diff --git a/modules/gui.lua b/modules/gui.lua index 80505dde..9c9aebfe 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -912,6 +912,11 @@ pfUI:RegisterModule("gui", function () "1:" .. T["1 Decimal (2.1)"], "2:" .. T["2 Decimals (2.14)"], }, + ["castbaralign"] = { + "LEFT:" .. T["Left"], + "CENTER:" .. T["Center"], + "RIGHT:" .. T["Right"], + }, ["orientation"] = { "HORIZONTAL:" .. T["Horizontal"], "VERTICAL:" .. T["Vertical"], @@ -2788,7 +2793,9 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, T["Castbar Height"], C.castbar.player, "height") CreateConfig(nil, T["Show Spell Icon"], C.castbar.player, "showicon", "checkbox") CreateConfig(nil, T["Show Spell Name"], C.castbar.player, "showname", "checkbox") + CreateConfig(nil, T["Spell Name Alignment"], C.castbar.player, "namealign", "dropdown", pfUI.gui.dropdowns.castbaralign) CreateConfig(nil, T["Show Timer"], C.castbar.player, "showtimer", "checkbox") + CreateConfig(nil, T["Timer Alignment"], C.castbar.player, "timealign", "dropdown", pfUI.gui.dropdowns.castbaralign) CreateConfig(nil, T["Left Text X Offset"], C.castbar.player, "txtleftoffx") CreateConfig(nil, T["Left Text Y Offset"], C.castbar.player, "txtleftoffy") CreateConfig(nil, T["Show Lag"], C.castbar.player, "showlag", "checkbox") @@ -2803,7 +2810,9 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, T["Castbar Height"], C.castbar.target, "height") CreateConfig(nil, T["Show Spell Icon"], C.castbar.target, "showicon", "checkbox") CreateConfig(nil, T["Show Spell Name"], C.castbar.target, "showname", "checkbox") + CreateConfig(nil, T["Spell Name Alignment"], C.castbar.target, "namealign", "dropdown", pfUI.gui.dropdowns.castbaralign) CreateConfig(nil, T["Show Timer"], C.castbar.target, "showtimer", "checkbox") + CreateConfig(nil, T["Timer Alignment"], C.castbar.target, "timealign", "dropdown", pfUI.gui.dropdowns.castbaralign) CreateConfig(nil, T["Left Text X Offset"], C.castbar.target, "txtleftoffx") CreateConfig(nil, T["Left Text Y Offset"], C.castbar.target, "txtleftoffy") CreateConfig(nil, T["Show Lag"], C.castbar.target, "showlag", "checkbox") @@ -2817,7 +2826,9 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, T["Castbar Height"], C.castbar.focus, "height") CreateConfig(nil, T["Show Spell Icon"], C.castbar.focus, "showicon", "checkbox") CreateConfig(nil, T["Show Spell Name"], C.castbar.focus, "showname", "checkbox") + CreateConfig(nil, T["Spell Name Alignment"], C.castbar.focus, "namealign", "dropdown", pfUI.gui.dropdowns.castbaralign) CreateConfig(nil, T["Show Timer"], C.castbar.focus, "showtimer", "checkbox") + CreateConfig(nil, T["Timer Alignment"], C.castbar.focus, "timealign", "dropdown", pfUI.gui.dropdowns.castbaralign) CreateConfig(nil, T["Left Text X Offset"], C.castbar.focus, "txtleftoffx") CreateConfig(nil, T["Left Text Y Offset"], C.castbar.focus, "txtleftoffy") CreateConfig(nil, T["Show Lag"], C.castbar.focus, "showlag", "checkbox")