I shamelessly ripped Jerry's code for GridLayout:Update and cleaned it of the pet part to fix a problem I've been having when using the unitsPerColumn = x, maxColumns = y parameters for layout (in this case it computes the size of background frame way too big).
I understand Jerry's work on pet for grid is still waiting for a global merge into trunk but could someone merge this meanwhile ? Anyway here is the code snippet :
function GridLayout:UpdateSize()
local p = self.db.profile
local layoutGroup
local groupCount, curWidth, curHeight, maxWidth, maxHeight
local x, y
if not InRaidOrBG() or p.showParty then
local f = self.partyGroup
f:UpdateSize()
local width, height = f:GetFrameWidth(), f:GetFrameHeight()
groupCount, curWidth, curHeight = 0, width, height
maxWidth, maxHeight = width, height
else
groupCount, curWidth, curHeight, maxWidth, maxHeight = -1, 0, 0, 0, 0
end
local Padding, Spacing = p.Padding, p.Spacing * 2
for _, layoutGroup in ipairs(self.layoutGroups) do
if layoutGroup:IsFrameVisible() then
groupCount = groupCount + 1
local width, height = layoutGroup:GetFrameWidth(), layoutGroup:GetFrameHeight()
curWidth = curWidth + width + Padding
curHeight = curHeight + height + Padding
if maxWidth < width then maxWidth = width end
if maxHeight < height then maxHeight = height end
end
end
if p.horizontal then
x = maxWidth + Spacing
y = curHeight + Spacing
else
x = curWidth + Spacing
y = maxHeight + Spacing
end
self.frame:SetWidth(x)
self.frame:SetHeight(y)
end
Nevermind, apparently it bugs out for Horizontal mode now... I know Jerry fixed this stuff but I can't find the relevant code snippet...
I guess I'll have to wait for merging to happen :(
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I understand Jerry's work on pet for grid is still waiting for a global merge into trunk but could someone merge this meanwhile ? Anyway here is the code snippet :
I guess I'll have to wait for merging to happen :(