diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-05-10 14:04:55 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-05-10 14:04:55 -0400 |
| commit | f81e4a813766980c6e837893e19cc10bf6d7c41e (patch) | |
| tree | c5917a944647f14a430a1ffdf514d9aa714589d2 /gui/widget | |
| parent | 39c1d74160b268cf8b573b3c0d5e5ce6b0920ee7 (diff) | |
| download | volute-f81e4a813766980c6e837893e19cc10bf6d7c41e.zip | |
text alignment
Diffstat (limited to 'gui/widget')
| -rw-r--r-- | gui/widget/input.go | 4 | ||||
| -rw-r--r-- | gui/widget/label.go | 2 | ||||
| -rw-r--r-- | gui/widget/output.go | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/gui/widget/input.go b/gui/widget/input.go index 954e7db..f47f587 100644 --- a/gui/widget/input.go +++ b/gui/widget/input.go @@ -64,9 +64,9 @@ Loop: func inputDraw(str []byte, focused bool, r image.Rectangle) func(draw.Image) image.Rectangle { return func(drw draw.Image) image.Rectangle { if focused { - text.Draw(str, drw, r, GREEN, FOCUS_COLOR) + text.Draw(str, drw, r, GREEN, FOCUS_COLOR, text.ALIGN_RIGHT) } else { - text.Draw(str, drw, r, GREEN, WHITE) + text.Draw(str, drw, r, GREEN, WHITE, text.ALIGN_RIGHT) } return r } diff --git a/gui/widget/label.go b/gui/widget/label.go index ed2d24c..fe451f8 100644 --- a/gui/widget/label.go +++ b/gui/widget/label.go @@ -15,7 +15,7 @@ func Label(str string, r image.Rectangle, env gui.Env, wg *sync.WaitGroup) { defer close(env.Draw()) redraw := func(drw draw.Image) image.Rectangle { - text.Draw([]byte(str), drw, r, BLACK, WHITE) + text.Draw([]byte(str), drw, r, BLACK, WHITE, text.ALIGN_LEFT) return r } diff --git a/gui/widget/output.go b/gui/widget/output.go index cfbdade..ecca18c 100644 --- a/gui/widget/output.go +++ b/gui/widget/output.go @@ -35,7 +35,7 @@ Loop: func outputDraw(v float64, r image.Rectangle) func(draw.Image) image.Rectangle { return func(drw draw.Image) image.Rectangle { - text.Draw([]byte(fmt.Sprintf("%.3f", v)), drw, r, BLACK, WHITE) + text.Draw([]byte(fmt.Sprintf("%.3f", v)), drw, r, BLACK, WHITE, text.ALIGN_RIGHT) return r } } |