From e609809ffff2dc7990a301c533efb599c8a14aa9 Mon Sep 17 00:00:00 2001 From: Abyss <74500190+vAbyss@users.noreply.github.com> Date: Mon, 2 Nov 2026 01:02:31 +0100 Subject: [PATCH] Raid unitframes: add option to reverse group order (#75) * Add raidreverse default to unitframes config Defaults to off, so existing layouts are unchanged. * Raid frames: add option to reverse group order Read the new raidreverse setting and mirror the column index when placing raid frames, so group 1 sits on the far right and the following groups grow to the left. * Add "Reverse Group Order" checkbox to raid settings Placed under "Raid Fill Direction" in the raid frame options. /pfui > Settings > Unit Frames > Raid > Layout * Raid frames: rename reverse option to "Grow Right To Left" The option mirrors columns in both fill directions, so name it for what it does. Mirror across the columns maxraid can fill instead of the whole layout, so smaller raids stay next to the anchor. Lay the raid grid out through SlotToCoord like the pet grid, move the default next to the other raid layout keys, and add the label to the locale tables. --------- Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com> --- api/config.lua | 3 ++- env/translations_deDE.lua | 1 + env/translations_enUS.lua | 1 + env/translations_esES.lua | 1 + env/translations_frFR.lua | 1 + env/translations_koKR.lua | 1 + env/translations_ruRU.lua | 1 + env/translations_zhCN.lua | 1 + env/translations_zhTW.lua | 1 + modules/gui.lua | 3 ++- modules/raid.lua | 38 ++++++++++++++++---------------------- 11 files changed, 28 insertions(+), 24 deletions(-) diff --git a/api/config.lua b/api/config.lua index d1bc2db6..dda046bf 100644 --- a/api/config.lua +++ b/api/config.lua @@ -460,6 +460,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "raid", "raidlayout", "8x5") pfUI:UpdateConfig("unitframes", "raid", "raidpadding", "3") pfUI:UpdateConfig("unitframes", "raid", "raidfill", "VERTICAL") + pfUI:UpdateConfig("unitframes", "raid", "raidgrowleft", "0") pfUI:UpdateConfig("unitframes", "raid", "collapse", "0") pfUI:UpdateConfig("unitframes", "raid", "raidgrouplabel", "0") pfUI:UpdateConfig("unitframes", "raid", "grouplabelxoff", "0") @@ -1528,4 +1529,4 @@ function pfUI:MigrateConfig() else pfUI_config.version = pfUI.version.string end -end \ No newline at end of file +end diff --git a/env/translations_deDE.lua b/env/translations_deDE.lua index c2cd89ca..0faac4bd 100644 --- a/env/translations_deDE.lua +++ b/env/translations_deDE.lua @@ -359,6 +359,7 @@ pfUI_translation["deDE"] = { ["Group Options"] = nil, ["Group-Pet"] = nil, ["Group-Target"] = nil, + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = nil, diff --git a/env/translations_enUS.lua b/env/translations_enUS.lua index 70c75089..e5115a0d 100644 --- a/env/translations_enUS.lua +++ b/env/translations_enUS.lua @@ -373,6 +373,7 @@ pfUI_translation["enUS"] = { ["Group Options"] = nil, ["Group-Pet"] = nil, ["Group-Target"] = nil, + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = nil, diff --git a/env/translations_esES.lua b/env/translations_esES.lua index 6f6ad371..0a0f7b63 100644 --- a/env/translations_esES.lua +++ b/env/translations_esES.lua @@ -359,6 +359,7 @@ pfUI_translation["esES"] = { ["Group Options"] = "Opciones de grupo", ["Group-Pet"] = "Mascota-Grupo", ["Group-Target"] = "Objetivo-Grupo", + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = "Conectados en hermandad", diff --git a/env/translations_frFR.lua b/env/translations_frFR.lua index d99cb5a9..a4463789 100644 --- a/env/translations_frFR.lua +++ b/env/translations_frFR.lua @@ -359,6 +359,7 @@ pfUI_translation["frFR"] = { ["Group Options"] = "Options de groupe", ["Group-Pet"] = "Groupe des familiers", ["Group-Target"] = "Groupe des cibles", + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = "Membres de guilde connectés", diff --git a/env/translations_koKR.lua b/env/translations_koKR.lua index 968508f3..b529de94 100644 --- a/env/translations_koKR.lua +++ b/env/translations_koKR.lua @@ -359,6 +359,7 @@ pfUI_translation["koKR"] = { ["Group Options"] = nil, ["Group-Pet"] = "파티-팻", ["Group-Target"] = "파티-타켓", + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = "접속중인 길드원", diff --git a/env/translations_ruRU.lua b/env/translations_ruRU.lua index e391f567..505f21eb 100644 --- a/env/translations_ruRU.lua +++ b/env/translations_ruRU.lua @@ -359,6 +359,7 @@ pfUI_translation["ruRU"] = { ["Group Options"] = "Настройки группы", ["Group-Pet"] = "Группа-питомец", ["Group-Target"] = "Группа-цель", + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = "Члены гильдии в сети", diff --git a/env/translations_zhCN.lua b/env/translations_zhCN.lua index 3204b180..fdbef233 100644 --- a/env/translations_zhCN.lua +++ b/env/translations_zhCN.lua @@ -359,6 +359,7 @@ pfUI_translation["zhCN"] = { ["Group Options"] = "队伍选项", ["Group-Pet"] = "小队宠物", ["Group-Target"] = "小队目标", + ["Grow Right To Left"] = nil, ["Gryphon"] = "狮鹫", ["Gryphons"] = "狮鹫(多个)", ["Guild Online"] = "公会在线", diff --git a/env/translations_zhTW.lua b/env/translations_zhTW.lua index 4f44985b..8c04c453 100644 --- a/env/translations_zhTW.lua +++ b/env/translations_zhTW.lua @@ -359,6 +359,7 @@ pfUI_translation["zhTW"] = { ["Group Options"] = nil, ["Group-Pet"] = "小隊寵物", ["Group-Target"] = "小隊目標", + ["Grow Right To Left"] = nil, ["Gryphon"] = nil, ["Gryphons"] = nil, ["Guild Online"] = "公會線上", diff --git a/modules/gui.lua b/modules/gui.lua index fdcf787d..c0657b3f 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2294,6 +2294,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(U["raid"], T["Raid Padding"], C.unitframes[c], "raidpadding") CreateConfig(U["raid"], T["Raid Layout"], C.unitframes[c], "raidlayout", "dropdown", pfUI.gui.dropdowns.uf_raidlayout) CreateConfig(U["raid"], T["Raid Fill Direction"], C.unitframes[c], "raidfill", "dropdown", pfUI.gui.dropdowns.orientation) + CreateConfig(U["raid"], T["Grow Right To Left"], C.unitframes[c], "raidgrowleft", "checkbox") CreateConfig(U["raid"], T["Collapse Empty Slots"], C.unitframes[c], "collapse", "checkbox") elseif c == "raidpet" then CreateConfig(U[c], T["Layout"], nil, nil, "header") @@ -3088,4 +3089,4 @@ pfUI:RegisterModule("gui", function () end end) end -end) \ No newline at end of file +end) diff --git a/modules/raid.lua b/modules/raid.lua index c0824970..992205a5 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -30,8 +30,8 @@ pfUI:RegisterModule("raid", function () -- flat pool of pet frames, laid out by LayoutPets (mirror or collapsed) pfUI.uf.raid.pets = {} - -- 1-based grid slot -> (row, col) for the current fill direction, matching - -- the raid grid's own fill loops. + -- 1-based grid slot -> (col, row) for the current fill direction, shared by + -- the raid and pet grids. local function SlotToCoord(slot, fill, x, y) slot = slot - 1 if fill == "VERTICAL" then @@ -75,12 +75,12 @@ pfUI:RegisterModule("raid", function () end end - local i = 1 local width = pfUI.uf.raid[1]:GetWidth()+2*default_border local height = pfUI.uf.raid[1]:GetHeight()+2*default_border local layout = pfUI.uf.raid[1].config.raidlayout local padding = tonumber(pfUI.uf.raid[1].config.raidpadding)*GetPerfectPixel() local fill = pfUI.uf.raid[1].config.raidfill + local growleft = pfUI.uf.raid[1].config.raidgrowleft == "1" local _, _, x, y = string.find(layout,"(.+)x(.+)") x, y = tonumber(x), tonumber(y) @@ -95,24 +95,18 @@ pfUI:RegisterModule("raid", function () } end - if fill == "VERTICAL" then - for r=1, x do for g=1, y do - if pfUI.uf.raid[i] then - pfUI.uf.raid[i]:ClearAllPoints() - pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height)) - UpdateMovable(pfUI.uf.raid[i], true) - end - i = i + 1 - end end - else - for g=1, y do for r=1, x do - if pfUI.uf.raid[i] then - pfUI.uf.raid[i]:ClearAllPoints() - pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height)) - UpdateMovable(pfUI.uf.raid[i], true) - end - i = i + 1 - end end + -- right to left mirrors across the columns maxraid can fill, so a smaller + -- raid stays next to the anchor instead of the far edge of the layout + local cols = min(x, fill == "VERTICAL" and ceil(maxraid / y) or maxraid) + + for i=1, x*y do + if pfUI.uf.raid[i] then + local r, g = SlotToCoord(i, fill, x, y) + if growleft then r = cols - r + 1 end + pfUI.uf.raid[i]:ClearAllPoints() + pfUI.uf.raid[i]:SetPoint("BOTTOMLEFT", (r-1)*(padding+width), (g-1)*(padding+height)) + UpdateMovable(pfUI.uf.raid[i], true) + end end self:LayoutPets() @@ -303,4 +297,4 @@ pfUI:RegisterModule("raid", function () pfUI.uf.raid:QueueUpdate(0) end end) -end) \ No newline at end of file +end)