layout: add "exp" format layout for expanding both constraints

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-16 20:51:20 +02:00
parent 759900902a
commit d7694ae95f
+8 -1
View File
@@ -47,7 +47,7 @@ type formatError string
// is one of north, northeast, east, southeast, south, southwest, west,
// northwest, center.
//
// hexpand/vexpand(widget) forces the horizontalor or vertical
// hexp/vexp/exp(widget) forces the horizontal, vertical or both
// constraints to their maximum before laying out widget.
//
// hcap/vcap(size, widget) caps the maximum horizontal or vertical
@@ -131,6 +131,13 @@ func formatLayout(gtx *Context, state *formatState, widgets []Widget) {
ctxLayout(gtx, cs, func() {
formatExpr(gtx, state, widgets)
})
case "exp":
cs := gtx.Constraints
cs.Width.Min = cs.Width.Max
cs.Height.Min = cs.Height.Max
ctxLayout(gtx, cs, func() {
formatExpr(gtx, state, widgets)
})
case "hcap":
w := parseValue(state)
expect(state, ",")