pub struct ScrollRoom {
pub offset: Pixels,
pub max_offset: Pixels,
}Expand description
Whether a vertically scrollable region can still absorb wheel motion in the direction the user is scrolling.
This is the containment test behind native scroll chaining: an inner
component traps the wheel while it has room, and releases it to the
surrounding page once it bottoms out or tops up. offset and max_offset
use the GPUI convention where the offset is zero at the top of the
content and -max_offset at the bottom.
Fields§
§offset: PixelsCurrent vertical scroll offset (zero or negative).
max_offset: PixelsMaximum magnitude of the offset (zero means nothing to scroll).
Implementations§
Source§impl ScrollRoom
impl ScrollRoom
Sourcepub fn new(offset: Pixels, max_offset: Pixels) -> Self
pub fn new(offset: Pixels, max_offset: Pixels) -> Self
Builds a room snapshot from a GPUI scroll handle’s reported state.
Sourcepub fn can_absorb(&self, delta_y: Pixels) -> bool
pub fn can_absorb(&self, delta_y: Pixels) -> bool
True when scrolling by delta_y (negative = down) would move this
region: it has scrollable content and is not already pinned against
the edge in that direction.
Sourcepub fn from_handle(handle: &ScrollHandle) -> Self
pub fn from_handle(handle: &ScrollHandle) -> Self
Snapshots the room from a GPUI ScrollHandle.
This is the form used by components whose scrolling lives in a
div().overflow_y_scroll().track_scroll(&handle) container.
Sourcepub fn from_list_state(state: &ListState) -> Self
pub fn from_list_state(state: &ListState) -> Self
Snapshots the room from a GPUI [gpui::ListState].
Trait Implementations§
Source§impl Clone for ScrollRoom
impl Clone for ScrollRoom
Source§fn clone(&self) -> ScrollRoom
fn clone(&self) -> ScrollRoom
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 ScrollRoom
Auto Trait Implementations§
impl Freeze for ScrollRoom
impl RefUnwindSafe for ScrollRoom
impl Send for ScrollRoom
impl Sync for ScrollRoom
impl Unpin for ScrollRoom
impl UnsafeUnpin for ScrollRoom
impl UnwindSafe for ScrollRoom
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Span], returning an
Instrumented wrapper.§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
Subscriber to this type, returning a
[WithDispatch] wrapper.