helium/layout/row.lua
Elmārs Āboliņš 43e307295e grid layout finished,
minor fixes
2021-06-15 23:55:49 +03:00

26 lines
547 B
Lua

local path = string.sub(..., 1, string.len(...) - string.len(".row"))
local layout = require(path..'.init')
---@class Row
local row = {}
row.__index = row
---@return layout
function row.new()
local self = setmetatable({}, row)
return layout(self, self.draw)
end
function row:draw(x, y, width, height, children, hpad, vpad, alignX)
local carriagePos = 0
if children then
for i, e in ipairs(children) do
local w, _ = e:getSize()
e:draw(x+carriagePos+hpad, y+vpad)
carriagePos = carriagePos + w + vpad
end
end
end
return row