From 552df5a9cdb58f56e3a770bed66064782bffcc90 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 13 Aug 2023 21:52:09 -0400 Subject: [PATCH] Add doc comments to the cut layout --- layouts/cut.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/layouts/cut.go b/layouts/cut.go index cbc3bd4..8fbbd1c 100644 --- a/layouts/cut.go +++ b/layouts/cut.go @@ -3,12 +3,14 @@ package layouts import "image" import "git.tebibyte.media/tomo/tomo" +// Cut is a layout that can be divided into smaller and smaller sections. type Cut struct { branches [2]*Cut expand [2]bool vertical bool } +// Vertical divides the layout in equal halves vertically. func (this *Cut) Vertical () (top, bottom *Cut) { this.fill() this.even() @@ -16,6 +18,8 @@ func (this *Cut) Vertical () (top, bottom *Cut) { return this.Branches() } +// Top divides the layout vertically, expanding the top half and contracting the +// bottom half. func (this *Cut) Top () (top, bottom *Cut) { this.fill() this.first() @@ -23,6 +27,8 @@ func (this *Cut) Top () (top, bottom *Cut) { return this.Branches() } +// Bottom divides the layout vertically, expanding the bottom half and +// contracting the top half. func (this *Cut) Bottom () (top, bottom *Cut) { this.fill() this.second() @@ -30,24 +36,30 @@ func (this *Cut) Bottom () (top, bottom *Cut) { return this.Branches() } +// Horizontal divides the layout in equal halves horizontally. func (this *Cut) Horizontal () (top, bottom *Cut) { this.fill() this.even() return this.Branches() } +// Left divides the layout horizontally, expanding the left half and contracting +// the right half. func (this *Cut) Left () (top, bottom *Cut) { this.fill() this.first() return this.Branches() } +// Right divides the layout horizontally, expanding the right half and +// contracting the left half. func (this *Cut) Right () (top, bottom *Cut) { this.fill() this.second() return this.Branches() } +// Branches returns the two halves of this layout. func (this *Cut) Branches () (first, second *Cut) { return this.branches[0], this.branches[1] }