#Problem with anchoring to Custom Grow

3 messages · Page 1 of 1 (latest)

neon rover
#

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
lilac sand
#

Just multiple rows can be done with the Grid setting, no need for code. That might just solve your other thing, though maybe not.

safe forum
#

Isn't that just a grid grow?
Asakawa is too bored.