mirror of
https://gitlab.com/luk3yx/minetest-flow.git
synced 2025-11-07 03:58:00 +01:00
Improve checkbox positioning
This commit is contained in:
parent
98203e032a
commit
8dd4d491a6
13
init.lua
13
init.lua
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user