local AURA_START_X = 5;
local AURA_START_Y = 32;
local AURA_OFFSET_Y = 3;
local LARGE_AURA_SIZE = 26;
local SMALL_AURA_SIZE = 17;
local AURA_ROW_WIDTH = 122;
local TOT_AURA_ROW_WIDTH = 101;
local NUM_TOT_AURA_ROWS = 2; -- TODO: replace with TOT_AURA_ROW_HEIGHT functionality if this becomes a problem
function TargetFrame_UpdateAuraPositions(self, auraName, numAuras, numOppositeAuras, largeAuraList, updateFunc, maxRowWidth, offsetX, mirrorAurasVertically)
-- a lot of this complexity is in place to allow the auras to wrap around the target of target frame if it's shown
-- Position auras
local size;
local offsetY = AURA_OFFSET_Y;
-- current width of a row, increases as auras are added and resets when a new aura's width exceeds the max row width
local rowWidth = 0;
local firstBuffOnRow = 1;
for i=1, numAuras do
-- update size and offset info based on large aura status
if ( largeAuraList[i] ) then
size = LARGE_AURA_SIZE;
offsetY = AURA_OFFSET_Y + AURA_OFFSET_Y;
else
size = SMALL_AURA_SIZE;
end
-- anchor the current aura
if ( i == 1 ) then
rowWidth = size;
self.auraRows = self.auraRows + 1;
else
rowWidth = rowWidth + size + offsetX;
end
if ( rowWidth > maxRowWidth ) then
-- this aura would cause the current row to exceed the max row width, so make this aura
-- the start of a new row instead
updateFunc(self, auraName, i, numOppositeAuras, firstBuffOnRow, size, offsetX, offsetY, mirrorAurasVertically);
rowWidth = size;
self.auraRows = self.auraRows + 1;
firstBuffOnRow = i;
offsetY = AURA_OFFSET_Y;
if ( self.auraRows > NUM_TOT_AURA_ROWS ) then
-- if we exceed the number of tot rows, then reset the max row width
-- note: don't have to check if we have tot because AURA_ROW_WIDTH is the default anyway
maxRowWidth = AURA_ROW_WIDTH;
end
else
updateFunc(self, auraName, i, numOppositeAuras, i - 1, size, offsetX, offsetY, mirrorAurasVertically);
end
end
end