PeaAshMeter 393638bb71 add type hints for EVERYTHING
organize ui into folders
implement element:traverseUp
2026-05-04 02:48:30 +03:00

33 lines
902 B
Lua

local Constraints = require "lib.simple_ui.core.constraints"
local SingleChildElement = require "lib.simple_ui.core.single_child_element"
--- @class ScreenArea : SingleChildElement
local element = setmetatable({}, SingleChildElement)
element.__index = element
element.type = "ScreenArea"
function element:layout()
local screenW, screenH = love.graphics.getWidth(), love.graphics.getHeight()
self.constraints = Constraints {
maxWidth = screenW,
maxHeight = screenH
}
self.size = Vec3 { screenW, screenH }
if not self.child then return end
self.child.constraints = Constraints {
maxWidth = screenW,
maxHeight = screenH,
}
self.child:layout()
self.child.offset = Vec3 {}
end
--- @return ScreenArea
--- @param values {child: UIElement?}
function element:new(values)
return SingleChildElement.new(self, values)
end
return element