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 "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
|
|
||||||
|
// Cut is a layout that can be divided into smaller and smaller sections.
|
||||||
type Cut struct {
|
type Cut struct {
|
||||||
branches [2]*Cut
|
branches [2]*Cut
|
||||||
expand [2]bool
|
expand [2]bool
|
||||||
vertical bool
|
vertical bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vertical divides the layout in equal halves vertically.
|
||||||
func (this *Cut) Vertical () (top, bottom *Cut) {
|
func (this *Cut) Vertical () (top, bottom *Cut) {
|
||||||
this.fill()
|
this.fill()
|
||||||
this.even()
|
this.even()
|
||||||
@ -16,6 +18,8 @@ func (this *Cut) Vertical () (top, bottom *Cut) {
|
|||||||
return this.Branches()
|
return this.Branches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Top divides the layout vertically, expanding the top half and contracting the
|
||||||
|
// bottom half.
|
||||||
func (this *Cut) Top () (top, bottom *Cut) {
|
func (this *Cut) Top () (top, bottom *Cut) {
|
||||||
this.fill()
|
this.fill()
|
||||||
this.first()
|
this.first()
|
||||||
@ -23,6 +27,8 @@ func (this *Cut) Top () (top, bottom *Cut) {
|
|||||||
return this.Branches()
|
return this.Branches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bottom divides the layout vertically, expanding the bottom half and
|
||||||
|
// contracting the top half.
|
||||||
func (this *Cut) Bottom () (top, bottom *Cut) {
|
func (this *Cut) Bottom () (top, bottom *Cut) {
|
||||||
this.fill()
|
this.fill()
|
||||||
this.second()
|
this.second()
|
||||||
@ -30,24 +36,30 @@ func (this *Cut) Bottom () (top, bottom *Cut) {
|
|||||||
return this.Branches()
|
return this.Branches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Horizontal divides the layout in equal halves horizontally.
|
||||||
func (this *Cut) Horizontal () (top, bottom *Cut) {
|
func (this *Cut) Horizontal () (top, bottom *Cut) {
|
||||||
this.fill()
|
this.fill()
|
||||||
this.even()
|
this.even()
|
||||||
return this.Branches()
|
return this.Branches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Left divides the layout horizontally, expanding the left half and contracting
|
||||||
|
// the right half.
|
||||||
func (this *Cut) Left () (top, bottom *Cut) {
|
func (this *Cut) Left () (top, bottom *Cut) {
|
||||||
this.fill()
|
this.fill()
|
||||||
this.first()
|
this.first()
|
||||||
return this.Branches()
|
return this.Branches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Right divides the layout horizontally, expanding the right half and
|
||||||
|
// contracting the left half.
|
||||||
func (this *Cut) Right () (top, bottom *Cut) {
|
func (this *Cut) Right () (top, bottom *Cut) {
|
||||||
this.fill()
|
this.fill()
|
||||||
this.second()
|
this.second()
|
||||||
return this.Branches()
|
return this.Branches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Branches returns the two halves of this layout.
|
||||||
func (this *Cut) Branches () (first, second *Cut) {
|
func (this *Cut) Branches () (first, second *Cut) {
|
||||||
return this.branches[0], this.branches[1]
|
return this.branches[0], this.branches[1]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user