Documentation
¶
Overview ¶
Package uidir holds an ambient, per-goroutine user-interface direction override. It is the layout-direction analogue of the per-goroutine theme stack in internal/theme: a github.com/belluikit/bellui/container.DirectionScope (or a direction-scoped window canvas) pushes its direction while it lays out and paints its subtree, so the canvas-free layout, measurement and shaping code that resolves direction through lang.IsRTLDirection picks up the scoped value instead of the process-global one.
Callers push only concrete directions (LTR or RTL); a DirectionAuto scope is a no-op that defers to the enclosing scope or the global setting, so the stack never contains DirectionAuto and Current is a single read of the top.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Current ¶
Current returns the ambient direction override in effect on the calling goroutine, if any. The bool is false when no scope is active, in which case callers fall back to the process-global direction. The returned direction is always concrete (LTR or RTL); see the package comment.
func Mark ¶
func Mark() int
Mark returns the calling goroutine's current direction-stack depth. Pair it with Restore (typically via defer) around a tree walk that does per-node Push/Pop in separate visitor callbacks: if a draw or layout panic unwinds past the matching Pops, Restore discards the orphaned entries so the per-goroutine stack does not leak and corrupt later direction resolution.
func Pop ¶
Pop removes the direction installed by the matching Push. A Pop balancing a bellui.DirectionAuto Push (which pushed nothing) is a no-op.
func Push ¶
Push installs d as the ambient direction for the calling goroutine until the matching Pop. It is called by a direction scope around the layout and paint of its subtree. Pushing bellui.DirectionAuto is a no-op so that an automatic scope transparently inherits the enclosing direction.
Types ¶
This section is empty.