pub struct ScrollState {
pub offset: f32,
/* private fields */
}Expand description
Scroll offset plus scrollbar-drag state of one scrolling container.
Fields§
§offset: f32Offset in GUI pixels (0 = top) — set it as the widget’s scroll_y.
Implementations§
Source§impl ScrollState
impl ScrollState
pub const fn new() -> ScrollState
Sourcepub fn is_dragging(&self) -> bool
pub fn is_dragging(&self) -> bool
The scrollbar knob is being dragged.
Sourcepub fn handle(
&mut self,
event: &str,
view: &LayoutNode,
wheel_step: f32,
) -> bool
pub fn handle( &mut self, event: &str, view: &LayoutNode, wheel_step: f32, ) -> bool
Applies one UI event; view is the container’s node from the frame
the user saw (UiRoot::find_node). wheel_step: pixels per wheel
notch. Returns true when the event was for the scrollbar/wheel —
the caller shouldn’t treat it as a click on the content.
scroll:DY— wheel; positive = up.click:X:Yon the knob grabs it; on the track jumps there (knob centred on the cursor) and keeps dragging.drag:X:Ymoves a grabbed knob;release:X:Ylets go.
Sourcepub fn handle_event(
&mut self,
event: &UiEvent<'_>,
view: &LayoutNode,
wheel_step: f32,
) -> bool
pub fn handle_event( &mut self, event: &UiEvent<'_>, view: &LayoutNode, wheel_step: f32, ) -> bool
Self::handle for a parsed event.
Sourcepub fn scroll_into_view(&mut self, top: f32, h: f32, view_h: f32)
pub fn scroll_into_view(&mut self, top: f32, h: f32, view_h: f32)
Scrolls the least amount that shows top..top + h (content
coordinates, 0 = the content’s top) in a view view_h tall.
Trait Implementations§
Source§impl Clone for ScrollState
impl Clone for ScrollState
Source§fn clone(&self) -> ScrollState
fn clone(&self) -> ScrollState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScrollState
Source§impl Debug for ScrollState
impl Debug for ScrollState
Source§impl Default for ScrollState
impl Default for ScrollState
Source§fn default() -> ScrollState
fn default() -> ScrollState
Returns the “default value” for a type. Read more
Source§impl PartialEq for ScrollState
impl PartialEq for ScrollState
impl StructuralPartialEq for ScrollState
Auto Trait Implementations§
impl Freeze for ScrollState
impl RefUnwindSafe for ScrollState
impl Send for ScrollState
impl Sync for ScrollState
impl Unpin for ScrollState
impl UnsafeUnpin for ScrollState
impl UnwindSafe for ScrollState
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.