Add doc comments to the cut layout
This commit is contained in:
parent
e09761dd98
commit
552df5a9cd
@ -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]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user