Documentation
¶
Overview ¶
Package hierarchy provides platform-neutral geometry and normalized tree helpers over the frozen device DTOs.
Index ¶
- Constants
- func Area(bounds device.Bounds) int64
- func Center(bounds device.Bounds) device.Point
- func FormatBounds(bounds device.Bounds) string
- func IsVisible(bounds, viewport device.Bounds) bool
- func ParseBounds(value string) (device.Bounds, error)
- func VisiblePercentage(bounds, viewport device.Bounds) float64
- type BoundsError
- type Element
Constants ¶
const MinimumVisiblePercentage = 0.10
MinimumVisiblePercentage is the exact hierarchy retention boundary.
Variables ¶
This section is empty.
Functions ¶
func FormatBounds ¶
FormatBounds renders normalized bounds using Android hierarchy syntax.
func ParseBounds ¶
ParseBounds parses [left,top][right,bottom] into the normalized bounds DTO.
func VisiblePercentage ¶
VisiblePercentage returns the portion of an element visible in the viewport. An element covering every viewport edge is fully visible even when the element itself extends beyond those edges.
Types ¶
type BoundsError ¶
BoundsError reports a malformed or inverted Android-style bounds value.
func (*BoundsError) Error ¶
func (e *BoundsError) Error() string
type Element ¶
type Element struct {
Node device.TreeNode
Bounds device.Bounds
HasBounds bool
Parent *Element
Children []*Element
Order int
}
Element is a normalized hierarchy node with explicit geometry, ancestry, and stable preorder identity. Node.Children is cleared; Children is authoritative.
func FilterVisible ¶
FilterVisible returns a pruned copy. Nodes without bounds are retained, and an otherwise invisible node remains when at least one child remains visible.