Skip to main content

Module direction

Module direction 

Source
Expand description

Which way the interface reads, and the logical styling that follows.

GPUI has no notion of a reading direction: Styled exposes pl/pr, ml/mr, border_l/border_r and a TextAlign of Left, Center and Right, all of them physical, and taffy’s logical properties are not surfaced. So the direction is a global here, reaching components the same way Theme does: a host sets it once, components read it during render, and nothing is threaded through a builder argument.

The vocabulary is start and end rather than left and right. Start is where reading begins, so it is the left edge in a left-to-right interface and the right edge in a right-to-left one. Anything that is genuinely physical — the edge a vertical scrollbar sits on, the axis of a chart — keeps saying left and right, because those do not move when the reading direction does.

Enums§

LayoutDirection
The direction the interface reads in.
LogicalSide
An edge named by reading order rather than by geometry.
PhysicalSide
An edge that does not move when the reading direction does.

Traits§

ActiveDirection
Reads the active reading direction from any context that dereferences to App, the way ActiveTheme reads the theme.
DirectionalExt
Logical box model helpers, named by reading order.

Functions§

install
Installs the direction global at its default. Idempotent.
set_layout_direction
Sets the reading direction and repaints every window.