Documentation
¶
Index ¶
- Variables
- type Box
- func (b Box) Aspect() float64
- func (b Box) Center() (x, y int)
- func (b Box) Clone() Box
- func (b Box) Constrain(other Box) Box
- func (b Box) Corners() BoxCorners
- func (b Box) Equals(other Box) bool
- func (b Box) Fit(other Box) Box
- func (b Box) GetBottom(defaults ...int) int
- func (b Box) GetLeft(defaults ...int) int
- func (b Box) GetRight(defaults ...int) int
- func (b Box) GetTop(defaults ...int) int
- func (b Box) Grow(other Box) Box
- func (b Box) Height() int
- func (b Box) IsBiggerThan(other Box) bool
- func (b Box) IsSmallerThan(other Box) bool
- func (b Box) IsZero() bool
- func (b Box) OuterConstrain(bounds, other Box) Box
- func (b Box) Shift(x, y int) Box
- func (b Box) String() string
- func (b Box) Validate() error
- func (b Box) Width() int
- type BoxCorners
- type Point
Constants ¶
This section is empty.
Variables ¶
var ( // BoxZero is a preset box that represents an intentional zero value. BoxZero = Box{IsSet: true} )
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box struct { Top int Left int Right int Bottom int IsSet bool // IsSet is true if the box is set to a values explicitly. }
Box represents the main 4 dimensions of a box.
func (Box) Constrain ¶
Constrain is similar to `Fit` except that it will work more literally like the opposite of grow.
func (Box) Fit ¶
Fit is functionally the inverse of grow. Fit maintains the original aspect ratio of the `other` box, but constrains it to the bounds of the target box.
func (Box) IsBiggerThan ¶
IsBiggerThan returns if a box is bigger than another box.
func (Box) IsSmallerThan ¶
IsSmallerThan returns if a box is smaller than another box.
func (Box) OuterConstrain ¶
OuterConstrain is similar to `Constraint` with the difference that it applies corrections
type BoxCorners ¶
type BoxCorners struct {
TopLeft, TopRight, BottomRight, BottomLeft Point
}
BoxCorners is a box with independent corners.
func (BoxCorners) Center ¶
func (bc BoxCorners) Center() (x, y int)
Center returns the center of the box
func (BoxCorners) Equals ¶
func (bc BoxCorners) Equals(other BoxCorners) bool
Equals returns if the box equals another box.
func (BoxCorners) Rotate ¶
func (bc BoxCorners) Rotate(thetaDegrees float64) BoxCorners
Rotate rotates the box.
func (BoxCorners) String ¶
func (bc BoxCorners) String() string