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> 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