size

package
v0.1.47 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NotSet = -1

Variables

View Source
var (
	TopStart     = BiasAlignment{-1, -1}
	TopCenter    = BiasAlignment{0, -1}
	TopEnd       = BiasAlignment{1, -1}
	CenterStart  = BiasAlignment{-1, 0}
	Center       = BiasAlignment{0, 0}
	CenterEnd    = BiasAlignment{1, 0}
	BottomStart  = BiasAlignment{-1, 1}
	BottomCenter = BiasAlignment{0, 1}
	BottomEnd    = BiasAlignment{1, 1}
)
View Source
var Clamp = helpers.Clamp

Functions

func ApplySizeDataToConstraints

func ApplySizeDataToConstraints(constraints layout.Constraints, sizeData SizeData) layout.Constraints

func CompareSize

func CompareSize(a, b SizeData) bool

func FillMax

func FillMax() ui.Modifier

func FillMaxHeight

func FillMaxHeight() ui.Modifier

func FillMaxWidth

func FillMaxWidth() ui.Modifier

func GetSizeConstraintsAndSizeData

func GetSizeConstraintsAndSizeData(constraints layout.Constraints, sizeData SizeData) image.Point

func Height

func Height(height int, options ...SizeOption) ui.Modifier

func Size

func Size(width, height int, options ...SizeOption) ui.Modifier

func Width

func Width(width int, options ...SizeOption) ui.Modifier

func WrapContentHeight

func WrapContentHeight(align ...Alignment) ui.Modifier

func WrapContentSize

func WrapContentSize(align ...Alignment) ui.Modifier

func WrapContentWidth

func WrapContentWidth(align ...Alignment) ui.Modifier

Types

type Alignment

type Alignment interface {
	Align(size image.Point, space image.Point, layoutDirection layoutnode.LayoutDirection) image.Point
}

Alignment is an interface that calculates the position of a child inside a parent container.

type BiasAlignment

type BiasAlignment struct {
	HorizontalBias float32
	VerticalBias   float32
}

BiasAlignment implements Alignment using a horizontal and vertical bias. bias is between -1 (start/top) and 1 (end/bottom).

func (BiasAlignment) Align

type ChainNode

type ChainNode = node.ChainNode

func NewSizeNode

func NewSizeNode(sizeData SizeData) ChainNode

NewSizeNode creates a new size node

type DrawModifierNode

type DrawModifierNode = layoutnode.DrawModifierNode

type Element

type Element = modifier.Element

type InspectableModifier

type InspectableModifier = modifier.InspectableModifier

type LayoutContext

type LayoutContext = layoutnode.LayoutContext

type LayoutModifierNode

type LayoutModifierNode = layoutnode.LayoutModifierNode

type LayoutWidget

type LayoutWidget = layoutnode.LayoutWidget

type ModifierInspectorInfo

type ModifierInspectorInfo = modifier.InspectorInfo

type Node

type Node = node.Node

type PointerModifierNode

type PointerModifierNode = layoutnode.PointerInputModifierNode

type SizeData

type SizeData struct {
	Width  int
	Height int

	FillMaxWidth  bool
	FillMaxHeight bool
	FillMax       bool

	// WrapContent options
	WrapWidth  bool
	WrapHeight bool
	Alignment  Alignment
	Unbounded  bool

	Required bool
}

type SizeElement

type SizeElement struct {
	// contains filtered or unexported fields
}

func (SizeElement) Create

func (be SizeElement) Create() Node

Create creates a new Chain Node instance

func (SizeElement) Equals

func (se SizeElement) Equals(other Element) bool

Equals checks if this element is equivalent to another used during filter operations like Modifier.Any

func (SizeElement) Size

func (se SizeElement) Size() SizeData

func (SizeElement) Update

func (be SizeElement) Update(node Node)

Update updates an existing Chain node for efficiency

type SizeNode

type SizeNode struct {
	ChainNode
	// contains filtered or unexported fields
}

type SizeOption

type SizeOption func(options *SizeOptions)

func SizeRequired

func SizeRequired() SizeOption

type SizeOptions

type SizeOptions struct {
	Required bool
}

func DefaultSizeOptions

func DefaultSizeOptions() SizeOptions

type TreeNode

type TreeNode = node.TreeNode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL