mirror of
https://gitlab.com/luk3yx/minetest-flow.git
synced 2025-09-12 09:46:30 +02:00
Document visible = false and no_prepend = true
This commit is contained in:
parent
299ccfcddc
commit
9cad6a94bd
34
README.md
34
README.md
@ -345,3 +345,37 @@ gui.Button{
|
|||||||
```
|
```
|
||||||
|
|
||||||
The style elements are invisible and won't affect padding.
|
The style elements are invisible and won't affect padding.
|
||||||
|
|
||||||
|
## Experimental features
|
||||||
|
|
||||||
|
These features might be broken in the future.
|
||||||
|
|
||||||
|
### Hiding elements
|
||||||
|
|
||||||
|
Elements inside boxes can have `visible = false` set to hide them from the
|
||||||
|
player. Elements hidden this way will still take up space like with
|
||||||
|
`visibility: hidden;` in CSS.
|
||||||
|
|
||||||
|
### `no_prepend[]`
|
||||||
|
|
||||||
|
You can set `no_prepend = true` on the "root" element to disable formspec
|
||||||
|
prepends.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local my_gui = flow.make_gui(function(player, ctx)
|
||||||
|
return gui.VBox{
|
||||||
|
no_prepend = true,
|
||||||
|
|
||||||
|
gui.Button{label = "Button 1"},
|
||||||
|
|
||||||
|
-- There will be an empty space where the second button would be
|
||||||
|
gui.Button{label = "Button 2", visible = false},
|
||||||
|
|
||||||
|
gui.Button{label = "Button 3"},
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
1
init.lua
1
init.lua
@ -419,6 +419,7 @@ local function render_ast(node)
|
|||||||
res[#res + 1] = {type = "no_prepend"}
|
res[#res + 1] = {type = "no_prepend"}
|
||||||
end
|
end
|
||||||
if node.fbgcolor then
|
if node.fbgcolor then
|
||||||
|
-- TODO: Fix this
|
||||||
res[#res + 1] = {
|
res[#res + 1] = {
|
||||||
type = "bgcolor",
|
type = "bgcolor",
|
||||||
bgcolor = node.fbgcolor,
|
bgcolor = node.fbgcolor,
|
||||||
|
Loading…
Reference in New Issue
Block a user