mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
+2
-2
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user