pub struct ScrollOutcome {
pub before: Offset,
pub after: Offset,
pub max_offset: Offset,
pub changed: bool,
}Expand description
Result of applying scroll logic.
§Examples
use ailloli_ui_core::{Offset, ScrollAxes, ScrollMetrics, ScrollState, Size};
let metrics = ScrollMetrics::new(Size::new(10.0, 10.0), Size::new(20.0, 20.0));
let outcome = ScrollState::new().scroll_to(Offset::new(5.0, 0.0), metrics, ScrollAxes::BOTH);
assert!(outcome.changed);Fields§
§before: OffsetOffset before the operation; it may itself be out of bounds.
after: OffsetClamped offset after the operation.
max_offset: OffsetMaximum valid offset for the enabled axes.
changed: boolWhether before and after differ by at least 0.001 on either axis.
Implementations§
Source§impl ScrollOutcome
impl ScrollOutcome
Sourcepub fn state(self) -> ScrollState
pub fn state(self) -> ScrollState
Converts the final offset into the next persistent scroll state.
§Examples
use ailloli_ui_core::{Offset, ScrollAxes, ScrollMetrics, ScrollState, Size};
let metrics = ScrollMetrics::new(Size::new(10.0, 10.0), Size::new(20.0, 20.0));
let state = ScrollState::new().scroll_to(Offset::new(5.0, 0.0), metrics, ScrollAxes::BOTH).state();
assert_eq!(state.offset, Offset::new(5.0, 0.0));Trait Implementations§
Source§impl Clone for ScrollOutcome
impl Clone for ScrollOutcome
Source§fn clone(&self) -> ScrollOutcome
fn clone(&self) -> ScrollOutcome
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScrollOutcome
impl Debug for ScrollOutcome
Source§impl PartialEq for ScrollOutcome
impl PartialEq for ScrollOutcome
impl Copy for ScrollOutcome
impl StructuralPartialEq for ScrollOutcome
Auto Trait Implementations§
impl Freeze for ScrollOutcome
impl RefUnwindSafe for ScrollOutcome
impl Send for ScrollOutcome
impl Sync for ScrollOutcome
impl Unpin for ScrollOutcome
impl UnwindSafe for ScrollOutcome
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