pub struct ScrollbarGeometry {
pub orientation: ScrollbarOrientation,
pub track_rect: LogicalRect,
pub button_size: f32,
pub usable_track_length: f32,
pub thumb_length: f32,
pub thumb_size_ratio: f32,
pub scroll_ratio: f32,
pub thumb_offset: f32,
pub max_scroll: f32,
pub width_px: f32,
}Expand description
Single source of truth for scrollbar geometry.
Computed once by compute_scrollbar_geometry, then used by:
- Display list painting (
paint_scrollbars) - GPU transform updates (
update_scrollbar_transforms) - Hit-testing (
hit_test_component) - Drag delta conversion (
handle_scrollbar_drag)
Fields§
§orientation: ScrollbarOrientationOrientation (vertical or horizontal)
track_rect: LogicalRectThe full track rect in the container’s coordinate space
Button size (square: width = height = scrollbar_width_px)
usable_track_length: f32Usable track length after subtracting buttons and corner = track_total - 2*button_size
thumb_length: f32The thumb length (min-clamped to 2*width_px)
thumb_size_ratio: f32Thumb size as ratio of viewport / content (0.0–1.0)
scroll_ratio: f32Scroll ratio (0.0 at top/left, 1.0 at bottom/right)
thumb_offset: f32Thumb offset in pixels from the start of the usable track region
max_scroll: f32Max scroll distance in content pixels
width_px: f32CSS-specified scrollbar thickness (width for vertical, height for horizontal)
Trait Implementations§
Source§impl Clone for ScrollbarGeometry
impl Clone for ScrollbarGeometry
Source§fn clone(&self) -> ScrollbarGeometry
fn clone(&self) -> ScrollbarGeometry
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 moreSource§impl Debug for ScrollbarGeometry
impl Debug for ScrollbarGeometry
Source§impl Default for ScrollbarGeometry
impl Default for ScrollbarGeometry
impl Copy for ScrollbarGeometry
Auto Trait Implementations§
impl Freeze for ScrollbarGeometry
impl RefUnwindSafe for ScrollbarGeometry
impl Send for ScrollbarGeometry
impl Sync for ScrollbarGeometry
impl Unpin for ScrollbarGeometry
impl UnsafeUnpin for ScrollbarGeometry
impl UnwindSafe for ScrollbarGeometry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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