layout/types.go
Functions
func Bounds
func (n NodeLayout) Bounds() geometry.Rect {
return geometry.FromPointSize(n.Position, n.Size)
}
func IsValid
IsValid returns true if the node ID is valid (non-zero).
func (n NodeID) IsValid() bool {
return n != InvalidNodeID
}
func IsZero
IsZero returns true if the layout has zero position and size.
func (n NodeLayout) IsZero() bool {
return n.Position.IsZero() && n.Size.IsZero()
}
func IsZero
IsZero returns true if the result has zero size.
func (r Result) IsZero() bool {
return r.Size.IsZero()
}
Structs
type NodeLayout struct
NodeLayout is the computed layout for a single node.
After a layout algorithm runs, each node will have a NodeLayout
describing its position relative to its parent and its computed size.
type NodeLayout struct {
// Position is the offset from the parent node's origin.
Position geometry.Point
// Size is the computed size of the node.
Size geometry.Size
}
type Result struct
Result is the output of a layout algorithm computation.
Result contains the computed size of the root node and indicates
whether the layout was successful.
type Result struct {
// Size is the computed size of the root node.
Size geometry.Size
// Overflow indicates if content exceeds the available space.
Overflow bool
}
Bounds returns the layout as a rectangle.