21 lines
473 B
Lua
21 lines
473 B
Lua
--- @class SingleChildElement : UIElement
|
|
--- @field child? UIElement
|
|
local element = setmetatable({}, require "lib.simple_ui.element")
|
|
element.__index = element
|
|
|
|
function element:layout()
|
|
if not self.child then return end
|
|
self.child.constraints = self.constraints
|
|
self.child:layout()
|
|
end
|
|
|
|
function element:update(dt)
|
|
if self.child then self.child:update(dt) end
|
|
end
|
|
|
|
function element:draw()
|
|
if self.child then self.child:draw() end
|
|
end
|
|
|
|
return element
|