pub struct ClippedItem { /* private fields */ }Expand description
Wraps a child so its rendered output is clipped to the child’s own layout rect. When the child
collapses to a zero rect (e.g. a section hidden via display:none), the clip is empty, so nothing
inside draws — even a widget left with a stale rect or one that paints at fixed coordinates. Layout
is unchanged: layout_node passes through to the wrapped child.
The pointer stops at the same edge. A press or a move landing outside the clip never reaches the subtree,
so a widget cut off by the clip cannot take the click that visually belongs to whatever is drawn over it —
clipped away is gone, not merely invisible. Everything else passes through: a release or a CursorLeft
is how a widget that was pressed or hovered inside the clip settles again, and swallowing those would leave
it stuck in a state the pointer has already left.
Implementations§
Source§impl ClippedItem
impl ClippedItem
pub fn new(inner: Box<dyn LayoutItem>) -> Self
Sourcepub fn along(inner: Box<dyn LayoutItem>, axis: ClipAxis) -> Self
pub fn along(inner: Box<dyn LayoutItem>, axis: ClipAxis) -> Self
A clip that cuts along axis only, leaving the other free.
What a strip of items wants when it has to stop at its ends but not across its thickness: a tab bar or a
toolbar cut where the room runs out, whose items still carry a focus ring, a badge or a shadow past the
strip’s own edge. CSS cannot express this — one axis set to hidden forces the other out of visible —
so a row that only wanted its ends cut has to clip the overflow it meant to keep.