diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-08-24 15:13:09 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-08-24 15:13:09 -0400 |
| commit | e725799ad17c575a7a3cd2536f57bd82f85782e5 (patch) | |
| tree | 4f4003524316d5a8a1d92ec33c71ed5a3aeb5a31 | |
| parent | a8a38817d7bdd7505a7156e390460d48863a6bb3 (diff) | |
| download | gui-e725799ad17c575a7a3cd2536f57bd82f85782e5.zip | |
adapt grid to new layout design
| -rw-r--r-- | grid.go (renamed from layout/grid.go) | 10 | ||||
| -rw-r--r-- | split.go (renamed from layout/split.go) | 2 |
2 files changed, 5 insertions, 7 deletions
@@ -1,15 +1,13 @@ -package layout +package gui import ( "image" "image/color" "image/draw" "log" - - "github.com/faiface/gui" ) -var _ Layout = Grid{} +var _ Scheme = Grid{} // Grid represents a grid with rows and columns in each row. // Each row can be a different length. @@ -50,11 +48,11 @@ func (g Grid) redraw(drw draw.Image, bounds image.Rectangle) { draw.Draw(drw, bounds.Inset(g.Border), image.NewUniform(col), image.ZP, draw.Src) } -func (g Grid) Intercept(env gui.Env) gui.Env { +func (g Grid) Intercept(env Env) Env { return RedrawIntercepter{g.redraw}.Intercept(env) } -func (g Grid) Lay(bounds image.Rectangle) []image.Rectangle { +func (g Grid) Partition(bounds image.Rectangle) []image.Rectangle { gap := g.Gap rows := g.Rows splitMain := g.Split diff --git a/layout/split.go b/split.go index db04225..ab6789b 100644 --- a/layout/split.go +++ b/split.go @@ -1,4 +1,4 @@ -package layout +package gui import "fmt" |