From 77be27094af288b80724ca86f44f34d60d0bcf84 Mon Sep 17 00:00:00 2001 From: Antoine Chedin Date: Sun, 1 Nov 2026 23:39:48 +0100 Subject: [PATCH] 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> --- api/config.lua | 4 ++++ api/unitframes.lua | 18 +++++++++++------- env/translations_enUS.lua | 4 ++++ modules/gui.lua | 4 ++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/api/config.lua b/api/config.lua index 95e032a8..d1bc2db6 100644 --- a/api/config.lua +++ b/api/config.lua @@ -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") diff --git a/api/unitframes.lua b/api/unitframes.lua index c1cb907b..82b8bff8 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -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 diff --git a/env/translations_enUS.lua b/env/translations_enUS.lua index 6cd37593..70c75089 100644 --- a/env/translations_enUS.lua +++ b/env/translations_enUS.lua @@ -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, diff --git a/modules/gui.lua b/modules/gui.lua index 44d4dcad..fdcf787d 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -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")