pub enum ScrollAlign {
Minimal,
Fraction(f32),
}Expand description
Where a WidgetEvent::ScrollIntoView target should come to rest on the
scroll container’s vertical axis.
The horizontal axis is always revealed minimally — a fraction only has an obvious meaning for the axis the request is about, and pinning a caret vertically must not yank a horizontally-scrolled view sideways.
Variants§
Minimal
Scroll the least amount that makes the target fully visible, and not at
all when it already is. This is what focus-driven reveals and
EventContext::ensure_visible
use, and it is the behaviour every scroll container had before
alignment existed.
Fraction(f32)
Pin the target at f of the way down the viewport — 0.0 flush with
the top, 0.5 centred, 1.0 flush with the bottom — whether or not
it is already visible. Being unconditional is the whole point: a
typewriter-scrolling caret that only moved the view when it fell off
the edge would not be pinned at all.
The container still clamps to its scroll range, so a target near the
start or end of the content comes to rest as close to f as the range
allows. See ScrollArea::scroll_past_end for buying range past the
end of the content so the last line can still reach the pin.
Trait Implementations§
Source§impl Clone for ScrollAlign
impl Clone for ScrollAlign
Source§fn clone(&self) -> ScrollAlign
fn clone(&self) -> ScrollAlign
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more