aboutsummaryrefslogtreecommitdiffstats
path: root/ui.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-05-09 17:32:54 -0400
committerSam Anthony <sam@samanthony.xyz>2024-05-09 17:32:54 -0400
commitd463bb90ad629dfc8f1cd4f4b6b9590b0008832d (patch)
treebf8763649c6a2f1af1fe46821216e327c094dcfa /ui.go
parent76980fe3014b5c133c4e30590e92bd922aa9b9c1 (diff)
downloadvolute-d463bb90ad629dfc8f1cd4f4b6b9590b0008832d.zip
tree widget
Diffstat (limited to 'ui.go')
-rw-r--r--ui.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/ui.go b/ui.go
index 9355989..64e7ce5 100644
--- a/ui.go
+++ b/ui.go
@@ -7,6 +7,7 @@ import (
"volute/gui"
"volute/gui/layout"
+ "volute/gui/text"
"volute/gui/widget"
)
@@ -23,7 +24,7 @@ func spawnWidgets(
Background: color.Gray{255},
Gap: 1,
Split: split,
- SplitRows: splitRows,
+ SplitRows: layout.TextRowSplit,
Margin: 0,
Border: 0,
BorderColor: color.Gray{16},
@@ -96,8 +97,8 @@ func spawnWidgets(
func split(elements int, space int) []int {
bounds := make([]int, elements)
widths := []int{
- widget.TextSize(WIDEST_LABEL).X,
- widget.TextSize("123456").X,
+ text.Size(WIDEST_LABEL).X,
+ text.Size("123456").X,
}
for i := 0; i < elements && space > 0; i++ {
bounds[i] = min(widths[min(i, len(widths)-1)], space)
@@ -105,13 +106,3 @@ func split(elements int, space int) []int {
}
return bounds
}
-
-func splitRows(elements int, space int) []int {
- bounds := make([]int, elements)
- height := widget.TextSize("1").Y
- for i := 0; i < elements && space > 0; i++ {
- bounds[i] = min(height, space)
- space -= bounds[i]
- }
- return bounds
-}