This is the custom grow function, sorry:
function(newPositions, activeRegions)
local iconsPerRow = 8
local spacingX = 46
local spacingY = 36
local total = #activeRegions
for i = 1, total do
local row = math.floor((i - 1) / iconsPerRow)
local colInRow = (i - 1) % iconsPerRow
local iconsInThisRow = math.min(iconsPerRow, total - row * iconsPerRow)
local rowWidth = (iconsInThisRow - 1) * spacingX
local x = colInRow * spacingX - rowWidth / 2
local y = -row * spacingY
newPositions[i] = {x, y}
end
end