Skip to content

Commit

Permalink
add docs for making a canvas grow to fill the available space for #1126
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Aug 12, 2024
1 parent db2fd62 commit ddb85a0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/content/2-widgets/5-media/canvases.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ core.NewCanvas(b).SetDraw(func(pc *paint.Context) {
})
```

You can change the size of the canvas:
You can change the size of a canvas:

```Go
c := core.NewCanvas(b).SetDraw(func(pc *paint.Context) {
Expand All @@ -104,3 +104,14 @@ c.Styler(func(s *styles.Style) {
s.Min.Set(units.Dp(128))
})
```

You can make a canvas grow to fill the available space:

```Go
c := core.NewCanvas(b).SetDraw(func(pc *paint.Context) {
pc.FillBox(math32.Vector2{}, math32.Vec2(1, 1), colors.Scheme.Primary.Base)
})
c.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1)
})
```

0 comments on commit ddb85a0

Please sign in to comment.