Skip to main content

BringIntoViewSpec

Enum BringIntoViewSpec 

Source
pub enum BringIntoViewSpec {
    Default,
    Pivot {
        parent_fraction: f32,
        child_fraction: f32,
    },
}
Expand description

Where a scroll container puts a child that asks to be seen, such as a control that takes focus. Compose’s BringIntoViewSpec, which a container reads from local_bring_into_view_spec().

Variants§

§

Default

Scrolls as little as shows the child, and not at all while the child is in view or larger than the container. Compose’s default spec.

§

Pivot

Puts the child’s leading edge at a fixed place in the container on every request, so focus stays at one place while the content moves. A child that would not fit after that place ends at the container’s end instead. Compose’s pivot spec on a TV is Pivot { parent_fraction: 0.3, child_fraction: 0.0 }.

Fields

§parent_fraction: f32

The place, as a fraction of the container’s size.

§child_fraction: f32

How far the child sits before that place, as a fraction of the child’s size: 0.5 centers it on the place.

Implementations§

Source§

impl BringIntoViewSpec

Source

pub fn calculate_scroll_distance( self, offset: f32, size: f32, container_size: f32, ) -> f32

How far the container scrolls to put a child where this spec wants it. The child starts offset past the container’s leading edge and is size long; the container is container_size long. A positive answer moves the content toward the leading edge. Compose’s calculateScrollDistance.

Trait Implementations§

Source§

impl Clone for BringIntoViewSpec

Source§

fn clone(&self) -> BringIntoViewSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BringIntoViewSpec

Source§

impl Debug for BringIntoViewSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for BringIntoViewSpec

Source§

fn default() -> BringIntoViewSpec

Returns the “default value” for a type. Read more
Source§

impl PartialEq for BringIntoViewSpec

Source§

fn eq(&self, other: &BringIntoViewSpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BringIntoViewSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> LayoutData for T
where T: Any + Debug + PartialEq,

Source§

fn same_as(&self, other: &(dyn LayoutData + 'static)) -> bool

Whether other holds the same data, so a parent can keep its last measure.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

The data as Any, to read it by its type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.