layout: invert baseline to measure positive distance from bottom

With an inverted baseline, the zero value results in the widget
baseline aligned to its bottom.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-16 00:36:31 +02:00
parent 8e3d03f2c4
commit e2d0b3cfca
6 changed files with 32 additions and 41 deletions
+2 -2
View File
@@ -170,7 +170,7 @@ func (in Inset) Layout(gtx *Context, w Widget) {
stack.Pop()
gtx.Dimensions = Dimensions{
Size: dims.Size.Add(image.Point{X: right + left, Y: top + bottom}),
Baseline: dims.Baseline + top,
Baseline: dims.Baseline + bottom,
}
}
@@ -217,7 +217,7 @@ func (a Align) Layout(gtx *Context, w Widget) {
stack.Pop()
gtx.Dimensions = Dimensions{
Size: sz,
Baseline: dims.Baseline + p.Y,
Baseline: dims.Baseline + sz.Y - dims.Size.Y - p.Y,
}
}