Add Offsets to unit frame buff/debuff (#74)

* Add anchor offset for unitframe buff or defuff

* Fix default values

* Stack a shared-corner aura block past the other block's Y offset, read the offsets without a table per icon

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
This commit is contained in:
Antoine Chedin
2026-11-01 16:39:48 -06:00
committed by GitHub
co-authored by Brues
parent 3e50a0b34f
commit 77be27094a
4 changed files with 23 additions and 7 deletions
+4
View File
@@ -550,6 +550,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", unit, "bufflimit", "32")
pfUI:UpdateConfig("unitframes", unit, "buffperrow", "8")
pfUI:UpdateConfig("unitframes", unit, "ownbuffsize", "-1")
pfUI:UpdateConfig("unitframes", unit, "buffoffx", "0")
pfUI:UpdateConfig("unitframes", unit, "buffoffy", "0")
pfUI:UpdateConfig("unitframes", unit, "buffspacingx", "1")
pfUI:UpdateConfig("unitframes", unit, "buffspacingy", "1")
pfUI:UpdateConfig("unitframes", unit, "debuffs", "TOPLEFT")
@@ -557,6 +559,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", unit, "debufflimit", "32")
pfUI:UpdateConfig("unitframes", unit, "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", unit, "owndebuffsize", "-1")
pfUI:UpdateConfig("unitframes", unit, "debuffoffx", "0")
pfUI:UpdateConfig("unitframes", unit, "debuffoffy", "0")
pfUI:UpdateConfig("unitframes", unit, "debuffspacingx", "1")
pfUI:UpdateConfig("unitframes", unit, "debuffspacingy", "1")
pfUI:UpdateConfig("unitframes", unit, "invert_healthbar", "0")
+11 -7
View File
@@ -19,11 +19,11 @@ local auraCorners = {
}
-- Flows the shown icons of an aura block outward from the frame edge, starting
-- `offset` away from it (its own row gap when nil): `perrow` icons per row,
-- each row as tall as its largest icon. The first `icons.own` icons are the
-- player's (C_UnitAuras lists them first) and use `icons.ownsize`. Returns the
-- offset just past the block's last row, where a block sharing the same corner
-- continues.
-- `offset` away from it (its own row gap when nil) and shifted on screen by
-- `offx`/`offy`: `perrow` icons per row, each row as tall as its largest icon.
-- The first `icons.own` icons are the player's (C_UnitAuras lists them first)
-- and use `icons.ownsize`. Returns the offset just past the block's last
-- shifted row, where a block sharing the same corner continues.
local function LayoutAuraBlock(unit, icons, offset)
local corner = auraCorners[icons.pos]
local anchor = unit.config.portraitheight ~= "-1" and unit.hp or unit
@@ -42,7 +42,7 @@ local function LayoutAuraBlock(unit, icons, offset)
local size = i <= icons.own and icons.ownsize or icons.size
icons[i]:SetSize(size, size)
icons[i]:ClearAllPoints()
icons[i]:SetPoint(corner[1], anchor, icons.pos, corner[2] * x, corner[3] * offset)
icons[i]:SetPoint(corner[1], anchor, icons.pos, icons.offx + corner[2] * x, icons.offy + corner[3] * offset)
x = x + size + icons.gapx
if size > rowsize then rowsize = size end
@@ -50,7 +50,7 @@ local function LayoutAuraBlock(unit, icons, offset)
i = i + 1
end
if col > 0 then offset = offset + rowsize + icons.gapy end
if col > 0 then offset = offset + rowsize + icons.gapy + corner[3] * icons.offy end
return offset
end
@@ -877,6 +877,8 @@ function pfUI.uf:UpdateConfig()
f.buffs.size = tonumber(f.config.buffsize)
f.buffs.ownsize = f.config.ownbuffsize == "-1" and f.buffs.size or tonumber(f.config.ownbuffsize)
f.buffs.perrow = tonumber(f.config.buffperrow)
f.buffs.offx = tonumber(f.config.buffoffx)
f.buffs.offy = tonumber(f.config.buffoffy)
f.buffs.gapx = aura_border + tonumber(f.config.buffspacingx)
f.buffs.gapy = aura_border + tonumber(f.config.buffspacingy)
f.buffs.own = 0
@@ -927,6 +929,8 @@ function pfUI.uf:UpdateConfig()
f.debuffs.size = tonumber(f.config.debuffsize)
f.debuffs.ownsize = f.config.owndebuffsize == "-1" and f.debuffs.size or tonumber(f.config.owndebuffsize)
f.debuffs.perrow = tonumber(f.config.debuffperrow)
f.debuffs.offx = tonumber(f.config.debuffoffx)
f.debuffs.offy = tonumber(f.config.debuffoffy)
f.debuffs.gapx = aura_border + tonumber(f.config.debuffspacingx)
f.debuffs.gapy = aura_border + tonumber(f.config.debuffspacingy)
f.debuffs.own = 0
+4
View File
@@ -90,6 +90,8 @@ pfUI_translation["enUS"] = {
["Buffs"] = nil,
["Buff Size"] = nil,
["Buff Spacing"] = nil,
["Buff X-Offset"] = nil,
["Buff Y-Offset"] = nil,
["Buff X-Spacing"] = nil,
["Buff Y-Spacing"] = nil,
["Buffs Per Row"] = nil,
@@ -196,6 +198,8 @@ pfUI_translation["enUS"] = {
["Debuff Position"] = nil,
["Debuffs"] = nil,
["Debuff Size"] = nil,
["Debuff X-Offset"] = nil,
["Debuff Y-Offset"] = nil,
["Debuff X-Spacing"] = nil,
["Debuff Y-Spacing"] = nil,
["Debuffs Per Row"] = nil,
+4
View File
@@ -2360,6 +2360,8 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(U[c], T["Buff Limit"], C.unitframes[c], "bufflimit")
CreateConfig(U[c], T["Buffs Per Row"], C.unitframes[c], "buffperrow")
CreateConfig(U[c], T["Own Buff Size"], C.unitframes[c], "ownbuffsize")
CreateConfig(U[c], T["Buff X-Offset"], C.unitframes[c], "buffoffx")
CreateConfig(U[c], T["Buff Y-Offset"], C.unitframes[c], "buffoffy")
CreateConfig(U[c], T["Buff X-Spacing"], C.unitframes[c], "buffspacingx")
CreateConfig(U[c], T["Buff Y-Spacing"], C.unitframes[c], "buffspacingy")
@@ -2369,6 +2371,8 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(U[c], T["Debuff Limit"], C.unitframes[c], "debufflimit")
CreateConfig(U[c], T["Debuffs Per Row"], C.unitframes[c], "debuffperrow")
CreateConfig(U[c], T["Own Debuff Size"], C.unitframes[c], "owndebuffsize")
CreateConfig(U[c], T["Debuff X-Offset"], C.unitframes[c], "debuffoffx")
CreateConfig(U[c], T["Debuff Y-Offset"], C.unitframes[c], "debuffoffy")
CreateConfig(U[c], T["Debuff X-Spacing"], C.unitframes[c], "debuffspacingx")
CreateConfig(U[c], T["Debuff Y-Spacing"], C.unitframes[c], "debuffspacingy")