Improve checkbox positioning

This commit is contained in:
luk3yx 2023-01-21 14:39:06 +13:00
parent 98203e032a
commit 8dd4d491a6

View File

@ -126,8 +126,12 @@ end
local function apply_padding(node, x, y)
local w, h = get_and_fill_in_sizes(node)
if node.type == "label" or node.type == "checkbox" then
-- Labels are positioned from the centre of the first line and checkboxes
-- are positioned from the centre.
if node.type == "label" then
y = y + LABEL_OFFSET
elseif node.type == "checkbox" then
y = y + h / 2
end
if node._padding_top then
@ -188,13 +192,6 @@ function size_getters.hbox(hbox)
end
end
-- Special cases
for _, node in ipairs(hbox) do
if node.type == "checkbox" then
node.y = height / 2
end
end
return x, height
end