View Single Post
09-09-17, 01:34 PM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
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:
  1. function BattleGroundEnemies:ButtonPositioning()
  2.  
  3.     local previousButton, buttons = self, self.Enemies
  4.     local spaceBetweenRows = self.db.profile.SpaceBetweenRows
  5.     local growDownwards = (self.db.profile.Growdirection == "downwards")
  6.     local mainWidth = self:GetWidth()
  7.  
  8.     for number, name in ipairs(self.EnemySortingTable) do
  9.         local enemyButton = buttons[name]
  10.         enemyButton.Position = number
  11.        
  12.         enemyButton:SetWidth(mainWidth)
  13.         enemyButton:ClearAllPoints()
  14.         if growDownwards then
  15.             enemyButton:SetPoint("TOPLEFT", previousButton, "BOTTOMLEFT", 0, -spaceBetweenRows)
  16.         else
  17.             enemyButton:SetPoint("BOTTOMLEFT", previousButton, "TOPLEFT", 0, spaceBetweenRows)
  18.         end
  19.         previousButton = enemyButton
  20.     end
  21. end

Try this to confirm or debunk this theory. (And please report your findings even if it solves your problem.)
__________________

Last edited by MunkDev : 09-09-17 at 01:48 PM.
  Reply With Quote