/
d.vision
/
division_engine_cpp
Обзор
Документация
Войти
/
d.vision
/
division_engine_cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
resources/scripts/views/container.lua
55 строк
1 KB
den163
Added scrollable widget. Improved error handling
30 ноя 2024, 23:46
30 ноя 2024, 23:46
5e455e6
Код
Авторство
О чём код?
local color = require 'color' local decorated_box = require 'views.decorated_box' local padded = require 'views.padded' local sized_box = require 'views.sized_box' local stack = require 'views.stack' ---@class ui.container.options ---@field child view?, ---@field margin padding?, ---@field padding padding?, ---@field background_color vec4?, ---@field border_radius border_radius?, ---@field width number? ---@field height number? ---@field block_input boolean? ---@param options ui.container.options ---@return view local function container(options) local background = decorated_box { color = options.background_color or color.WHITE, border_radius = options.border_radius, block_input = options.block_input } local result if options.child then local child = options.child if options.padding ~= nil then child = padded { child = options.child, padding = options.padding } end result = stack { fit = stack.fit_type.shrink, children = { background, child } } else result = background end if options.width ~= nil or options.height ~= nil then result = sized_box { width = options.width, height = options.height, child = result } end if options.margin ~= nil then result = padded { padding = options.margin, child = result } end return result end return container