Skip to content

Commit

Permalink
Update Auras.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
noname08662 authored Dec 16, 2024
1 parent 3075edf commit 871bb6e
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions Modules/Unitframes/Auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -401,71 +401,82 @@ function mod:UpdateCenteredAuras(enable)
isVertical = true,
firstInRowPoint = 'BOTTOM',
subsequentPoint = 'BOTTOMLEFT',
framePoint = 'BOTTOM'
framePoint = 'BOTTOM',
growthX = 1,
},
["TOP"] = {
isVertical = true,
firstInRowPoint = 'BOTTOM',
subsequentPoint = 'BOTTOMLEFT',
framePoint = 'BOTTOM'
framePoint = 'BOTTOM',
growthX = 1,
},
["BOTTOM"] = {
isVertical = true,
isReverse = true,
firstInRowPoint = 'TOP',
subsequentPoint = 'TOPLEFT',
framePoint = 'TOP'
framePoint = 'TOP',
growthX = 1,
},
["LEFT"] = {
isVertical = false,
firstInRowPoint = 'RIGHT',
subsequentPoint = 'TOPRIGHT',
framePoint = 'RIGHT'
framePoint = 'RIGHT',
growthX = 1,
},
["RIGHT"] = {
isVertical = false,
isReverse = true,
firstInRowPoint = 'LEFT',
subsequentPoint = 'TOPLEFT',
framePoint = 'LEFT'
framePoint = 'LEFT',
growthX = -1,
},
["TOPLEFT"] = {
isVertical = true,
firstInRowPoint = 'BOTTOM',
subsequentPoint = 'BOTTOMLEFT',
framePoint = 'BOTTOM'
framePoint = 'BOTTOM',
growthX = 1,
},
["TOPRIGHT"] = {
isVertical = true,
firstInRowPoint = 'BOTTOM',
subsequentPoint = 'BOTTOMLEFT',
framePoint = 'BOTTOM'
framePoint = 'BOTTOM',
growthX = -1,
},
["BOTTOMLEFT"] = {
isVertical = true,
isReverse = true,
firstInRowPoint = 'TOP',
subsequentPoint = 'TOPLEFT',
framePoint = 'TOP'
framePoint = 'TOP',
growthX = 1,
},
["BOTTOMRIGHT"] = {
isVertical = true,
isReverse = true,
firstInRowPoint = 'TOP',
subsequentPoint = 'TOPLEFT',
framePoint = 'TOP'
framePoint = 'TOP',
growthX = -1,
}
}

function mod:CenterAlignAuras(frame, numElements, perRow, offset)
if not numElements or perRow == 1 then return end

local anchorPoint = frame.anchorPoint
local isVertical = directionProperties[anchorPoint].isVertical
local isReverse = directionProperties[anchorPoint].isReverse
local firstInRowPoint = directionProperties[anchorPoint].firstInRowPoint
local subsequentPoint = directionProperties[anchorPoint].subsequentPoint
local framePoint = directionProperties[anchorPoint].framePoint
local points = directionProperties[anchorPoint]
local isVertical = points.isVertical
local isReverse = points.isReverse
local firstInRowPoint = points.firstInRowPoint
local subsequentPoint = points.subsequentPoint
local framePoint = points.framePoint
local growthX = points.growthX

for i = 1, numElements do
local child = frame[i]
Expand All @@ -474,12 +485,12 @@ function mod:UpdateCenteredAuras(enable)
if i == (perRow * floor(i / perRow) + 1) then
local numOtherRow = min(perRow, (numElements - (perRow * floor(i / perRow))))
local OtherRowSize = (numOtherRow * offset)
local xOffset = isVertical and -(OtherRowSize - offset) / 2 or ((isReverse and 1 or -1) * offset * floor(i / perRow))
local xOffset = (isVertical and -(OtherRowSize - offset) / 2 or ((isReverse and 1 or -1) * offset * floor(i / perRow))) * growthX
local yOffset = isVertical and ((isReverse and -1 or 1) * offset * floor(i / perRow)) or -(OtherRowSize - offset) / 2
child:Point(firstInRowPoint, frame, framePoint, xOffset, yOffset)
anchorPoint = child
else
local xOffset = isVertical and offset or 0
local xOffset = (isVertical and offset or 0) * growthX
local yOffset = isVertical and 0 or offset
child:Point(subsequentPoint, anchorPoint, subsequentPoint, xOffset, yOffset)
anchorPoint = child
Expand Down Expand Up @@ -871,4 +882,4 @@ function mod:InitializeCallback()
mod:Toggle(db)
end

core.modules[modName] = mod.InitializeCallback
core.modules[modName] = mod.InitializeCallback

0 comments on commit 871bb6e

Please sign in to comment.