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.