From 00b9ff603f381885c2a393ac84545a0d64069529 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 15 Jul 2019 21:07:52 +0200 Subject: [PATCH] ui/layout: rename Insets to Inset and EqualInsets to UniformInset Rename Insets to the verb Inset for consistency with Align. Uniform is a better description than Equal for the result of UniformInset. Signed-off-by: Elias Naur --- ui/layout/layout.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui/layout/layout.go b/ui/layout/layout.go index 40b5b31a..cf5755cc 100644 --- a/ui/layout/layout.go +++ b/ui/layout/layout.go @@ -51,7 +51,7 @@ func RigidConstraints(size image.Point) Constraints { } } -type Insets struct { +type Inset struct { Top, Right, Bottom, Left ui.Value top, right, bottom, left int @@ -60,7 +60,7 @@ type Insets struct { cs Constraints } -func (in *Insets) Begin(c ui.Config, ops *ui.Ops, cs Constraints) Constraints { +func (in *Inset) Begin(c ui.Config, ops *ui.Ops, cs Constraints) Constraints { if in.begun { panic("must End before Begin") } @@ -97,7 +97,7 @@ func (in *Insets) Begin(c ui.Config, ops *ui.Ops, cs Constraints) Constraints { return mcs } -func (in *Insets) End(dims Dimens) Dimens { +func (in *Inset) End(dims Dimens) Dimens { if !in.begun { panic("must Begin before End") } @@ -110,8 +110,10 @@ func (in *Insets) End(dims Dimens) Dimens { } } -func EqualInsets(v ui.Value) Insets { - return Insets{Top: v, Right: v, Bottom: v, Left: v} +// UniformInset returns an Inset with a single inset applied to all +// edges. +func UniformInset(v ui.Value) Inset { + return Inset{Top: v, Right: v, Bottom: v, Left: v} } type Align struct {