forked from your-land-mirror/minetest-flow
Fix gui.Stack expanding
This commit is contained in:
parent
451f679ddc
commit
5f2e601938
16
init.lua
16
init.lua
@ -320,10 +320,18 @@ local function expand(box)
|
||||
(box_type == "padding" and box[1].expand) then
|
||||
box.type = "container"
|
||||
for _, node in ipairs(box) do
|
||||
align_types[node.align_h or "auto"](node, "x", "w", box.w -
|
||||
node.w - (node.padding or 0) * 2)
|
||||
align_types[node.align_v or "auto"](node, "y", "h", box.h -
|
||||
node.h - (node.padding or 0) * 2 - (node._padding_top or 0))
|
||||
if not invisible_elems[node.type] then
|
||||
local width, height = node.w or 0, node.h or 0
|
||||
if node.type == "list" then
|
||||
width = width * 1.25 - 0.25
|
||||
height = height * 1.25 - 0.25
|
||||
end
|
||||
local padding_x2 = (node.padding or 0) * 2
|
||||
align_types[node.align_h or "auto"](node, "x", "w", box.w -
|
||||
width - padding_x2)
|
||||
align_types[node.align_v or "auto"](node, "y", "h", box.h -
|
||||
height - padding_x2 - (node._padding_top or 0))
|
||||
end
|
||||
end
|
||||
return expand_child_boxes(box)
|
||||
elseif box_type == "container" or box_type == "scroll_container" then
|
||||
|
||||
6
test.lua
6
test.lua
@ -239,6 +239,9 @@ describe("Flow", function()
|
||||
gui.Field{name = "5", label = "", align_v = "fill"},
|
||||
|
||||
gui.Label{label = "Test", align_h = "centre"},
|
||||
|
||||
gui.List{inventory_location = "a", list_name = "b", w = 2, h = 2},
|
||||
gui.Style{selectors = {"test"}, props = {prop = "value"}},
|
||||
}, [[
|
||||
size[3.6,3.6]
|
||||
field_close_on_enter[4;false]
|
||||
@ -250,6 +253,9 @@ describe("Flow", function()
|
||||
|
||||
image_button[0.3,1.6;3,0.4;blank.png;;Test;;false]
|
||||
image_button[0.3,1.6;3,0.4;blank.png;;;;false]
|
||||
|
||||
list[a;b;0.675,0.675;2,2]
|
||||
style[test;prop=value]
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user