From 691b73337ce0a7f17e9dcb3b64d2666c67af5d94 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Fri, 4 Oct 2024 01:15:39 +0200 Subject: [PATCH] Adjust List child position calculation --- gfx/list.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/list.lua b/gfx/list.lua index f8084d4..f8c46aa 100644 --- a/gfx/list.lua +++ b/gfx/list.lua @@ -5,15 +5,15 @@ local List = Element:new{ } local function adjustPositions(elements, vertical, from) - local newDims = 0 + local newDims = 1 local getDim = vertical and function(e) return e:getHeight() end or function(e) return e:getWidth() end for i=1,from-1 do newDims = newDims + getDim(elements[i]) end - local setDim = vertical and function(e, dim) e:setPos(0, dim) end or function(e, dim) e:setPos(dim, 0) end + local setDim = vertical and function(e, dim) e:setPos(1, dim) end or function(e, dim) e:setPos(dim, 1) end for i=from,#elements do - setDim(elements[i]) + setDim(elements[i], newDims) newDims = newDims + getDim(elements[i]) end end