diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-02-11 17:42:51 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-02-11 17:42:51 -0500 |
| commit | c8610ea4164403c418c3fc13aee13685aeff447f (patch) | |
| tree | 06e0d4b2012b791fd6bec059d6cde0fd22a3d5e1 /layout/resize.go | |
| parent | ebc5d96f0614ab3b4f2073eadf22fbe554b0ec8f (diff) | |
| download | gui-c8610ea4164403c418c3fc13aee13685aeff447f.zip | |
add border layout
Diffstat (limited to 'layout/resize.go')
| -rw-r--r-- | layout/resize.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/layout/resize.go b/layout/resize.go deleted file mode 100644 index 1d3d6f1..0000000 --- a/layout/resize.go +++ /dev/null @@ -1,35 +0,0 @@ -package layout - -import "image" - -// ResizeAll resizes a layout to consume all of its parent's area. -func ResizeAll(r image.Rectangle) image.Rectangle { return r } - -// ResizeQuad1 resizes a layout to consume the top-right quadrant of its parent. -func ResizeQuad1(r image.Rectangle) image.Rectangle { - mid := midpoint(r) - return image.Rect(mid.X, r.Min.Y, r.Max.X, mid.Y) -} - -// ResizeQuad2 resizes a layout to consume the top-left quadrant of its parent. -func ResizeQuad2(r image.Rectangle) image.Rectangle { - mid := midpoint(r) - return image.Rectangle{r.Min, mid} -} - -// ResizeQuad3 resizes a layout to consume the bottom-left quadrant of its parent. -func ResizeQuad3(r image.Rectangle) image.Rectangle { - mid := midpoint(r) - return image.Rect(r.Min.X, mid.Y, mid.X, r.Max.Y) -} - -// ResizeQuad4 resizes a layout to consume the bottom-right quadrant of its parent. -func ResizeQuad4(r image.Rectangle) image.Rectangle { - mid := midpoint(r) - return image.Rectangle{mid, r.Max} -} - -// midpoint returns the point in the middle of a rectangle. -func midpoint(r image.Rectangle) image.Point { - return r.Min.Add(r.Max).Div(2) -} |