Skip to content

Commit

Permalink
docs: improve the ui.Layout() doc (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
BBOOXX authored Mar 14, 2024
1 parent a4d8d97 commit 56941e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/plugins/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ Methods (all methods return `self`):
Create a layout:

```lua
ui.Layout()
local areas = ui.Layout()
:direction(ui.Layout.HORIZONTAL)
:constraints({ ui.Constraint.Percentage(50), ui.Constraint.Percentage(50) })
:split(area)

local left = areas[1] -- The first rect
local right = areas[2] -- The second rect
```

Methods (all methods return `self`):
Expand All @@ -120,8 +126,8 @@ Methods (all methods return `self`):
- `margin(margin)` - Set the margin of the layout, which accepts an positive integer.
- `margin_h(margin)` - Set the horizontal margin of the layout, which accepts an positive integer.
- `margin_v(margin)` - Set the vertical margin of the layout, which accepts an positive integer.
- `constraints({ constraint, ... })` - Set the constraints of the layout, which accepts a list of [Constraint](#constraint)
- `split(rect)` - Accepts a [Rect](#rect) and split it into multiple [Rect](#rect) according to the constraints
- `constraints({ constraint, ... })` - Set the constraints of the layout, which accepts a list of [Constraint](#constraint).
- `split(rect)` - Accepts a [Rect](#rect) and split it into multiple [Rect](#rect) according to the constraints.

## Line

Expand Down

0 comments on commit 56941e2

Please sign in to comment.