pub struct OffsetElement { /* private fields */ }Expand description
Element that offsets its content by a fixed (x, y) amount.
Matches Kotlin: OffsetElement in foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Offset.kt
Implementations§
Source§impl OffsetElement
impl OffsetElement
Sourcepub fn new(x: f32, y: f32, rtl_aware: bool) -> Self
pub fn new(x: f32, y: f32, rtl_aware: bool) -> Self
Creates an element that moves content by x and y, in logical pixels. With rtl_aware
set, a right-to-left layout direction mirrors x.
Sourcepub fn offset(&self, direction: LayoutDirection) -> Point
pub fn offset(&self, direction: LayoutDirection) -> Point
Returns the offset in logical pixels as a layout of direction applies it: x mirrored
when the element is RTL aware and the direction is right-to-left.
Trait Implementations§
Source§impl Clone for OffsetElement
impl Clone for OffsetElement
impl Copy for OffsetElement
Source§impl Debug for OffsetElement
impl Debug for OffsetElement
Source§impl PartialEq for OffsetElement
impl PartialEq for OffsetElement
Source§impl PlainElement for OffsetElement
impl PlainElement for OffsetElement
Source§const WORDS: usize = 3
const WORDS: usize = 3
How many words the value takes: at most
PLAIN_WORDS_MAX.Source§const CAPABILITIES: NodeCapabilities = NodeCapabilities::LAYOUT
const CAPABILITIES: NodeCapabilities = NodeCapabilities::LAYOUT
What the element takes part in: layout, draw or both.
Source§const UPDATE_INVALIDATION: Option<InvalidationKind>
const UPDATE_INVALIDATION: Option<InvalidationKind>
The one pipeline stage a changed value invalidates, or
None to
invalidate every stage of Self::CAPABILITIES.Source§const LAYOUT: Option<&'static PlainLayoutFns>
const LAYOUT: Option<&'static PlainLayoutFns>
How the element measures the content it wraps, for an element with
NodeCapabilities::LAYOUT: Some(&PlainLayoutFns::of::<Self>())
for a PlainLayout. None, the default, passes the content’s
measure through.Source§fn to_words(&self, words: &mut [u32])
fn to_words(&self, words: &mut [u32])
Writes the value into
words, which holds Self::WORDS words.Source§fn from_words(words: &[u32]) -> Self
fn from_words(words: &[u32]) -> Self
The value that
Self::to_words wrote into words.Source§fn inspector_name(&self) -> &'static str
fn inspector_name(&self) -> &'static str
Human readable name surfaced to inspector tooling.
Source§impl PlainLayout for OffsetElement
impl PlainLayout for OffsetElement
Source§const PREPARES: bool = true
const PREPARES: bool = true
Whether
Self::prepared changes the element: false, the
default, lets a coordinator copy the words as they are.Source§fn prepared(self, at: PrepareAt) -> Self
fn prepared(self, at: PrepareAt) -> Self
The element as a coordinator keeps it for the measures
at tells:
an element that rounds its values to device pixels, or mirrors them
for a layout direction, may do so here once, and measure from those
values. The default is the element itself.Source§fn measure_hold(
&self,
_density: f32,
_constraints: Constraints,
_size: Size,
wrapped: WrappedHold,
) -> Option<ConstraintsHold>
fn measure_hold( &self, _density: f32, _constraints: Constraints, _size: Size, wrapped: WrappedHold, ) -> Option<ConstraintsHold>
The incoming constraints the last measure, which gave
size under
constraints, holds for; see
super::super::LayoutModifierNode::measure_hold.Source§fn measure(
&self,
context: &mut dyn ModifierNodeContext,
measurable: &dyn Measurable,
constraints: Constraints,
) -> LayoutModifierMeasureResult
fn measure( &self, context: &mut dyn ModifierNodeContext, measurable: &dyn Measurable, constraints: Constraints, ) -> LayoutModifierMeasureResult
Measures the wrapped content under
constraints and returns the size
the element takes and where it places the content.Source§fn intrinsic(
&self,
measurable: &dyn Measurable,
kind: PlainIntrinsic,
_density: f32,
) -> f32
fn intrinsic( &self, measurable: &dyn Measurable, kind: PlainIntrinsic, _density: f32, ) -> f32
The intrinsic size
kind names: the wrapped content’s by default,
for an element that keeps the content’s size.impl StructuralPartialEq for OffsetElement
Auto Trait Implementations§
impl Forget for OffsetElement
impl Freeze for OffsetElement
impl Move for OffsetElement
impl RefUnwindSafe for OffsetElement
impl Send for OffsetElement
impl Sync for OffsetElement
impl Unpin for OffsetElement
impl UnsafeUnpin for OffsetElement
impl UnwindSafe for OffsetElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more