mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-02 17:06:57 +00:00
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>
This commit is contained in:
+2
-1
@@ -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)
|
||||
end)
|
||||
|
||||
+16
-22
@@ -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)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user