Just speculating here, but since you're anchoring both top corners to the bottom corners of the previous button (or vice versa), is it possible that the slowdown happens because it needs to go back up the chain with each iteration to find out where to draw the next button? When you anchor two opposite corners, it'll ultimately use the distance between them to determine the span instead of whatever value you feed to it.
A conversation between them might look like a little bit like this:
- "I was supposed to anchor to you and match your width. Where should I draw myself?"
- "I don't really know, I'll ask the guy I'm anchored to because he's in control of my position."
* repeat until the first button is reached *
Lua Code:
function BattleGroundEnemies:ButtonPositioning()
local previousButton, buttons = self, self.Enemies
local spaceBetweenRows = self.db.profile.SpaceBetweenRows
local growDownwards = (self.db.profile.Growdirection == "downwards")
local mainWidth = self:GetWidth()
for number, name in ipairs(self.EnemySortingTable) do
local enemyButton = buttons[name]
enemyButton.Position = number
enemyButton:SetWidth(mainWidth)
enemyButton:ClearAllPoints()
if growDownwards then
enemyButton:SetPoint("TOPLEFT", previousButton, "BOTTOMLEFT", 0, -spaceBetweenRows)
else
enemyButton:SetPoint("BOTTOMLEFT", previousButton, "TOPLEFT", 0, spaceBetweenRows)
end
previousButton = enemyButton
end
end
Try this to confirm or debunk this theory. (And please report your findings even if it solves your problem.)