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 }.
Implementations§
Source§impl BringIntoViewSpec
impl BringIntoViewSpec
Sourcepub fn calculate_scroll_distance(
self,
offset: f32,
size: f32,
container_size: f32,
) -> f32
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
impl Clone for BringIntoViewSpec
Source§fn clone(&self) -> BringIntoViewSpec
fn clone(&self) -> BringIntoViewSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BringIntoViewSpec
Source§impl Debug for BringIntoViewSpec
impl Debug for BringIntoViewSpec
Source§impl Default for BringIntoViewSpec
impl Default for BringIntoViewSpec
Source§fn default() -> BringIntoViewSpec
fn default() -> BringIntoViewSpec
Source§impl PartialEq for BringIntoViewSpec
impl PartialEq for BringIntoViewSpec
impl StructuralPartialEq for BringIntoViewSpec
Auto Trait Implementations§
impl Freeze for BringIntoViewSpec
impl RefUnwindSafe for BringIntoViewSpec
impl Send for BringIntoViewSpec
impl Sync for BringIntoViewSpec
impl Unpin for BringIntoViewSpec
impl UnsafeUnpin for BringIntoViewSpec
impl UnwindSafe for BringIntoViewSpec
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
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> ⓘ
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> ⓘ
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