Skip to main content

Module scrollbar

Module scrollbar 

Source
Expand description

An explicit scrollbar: a track, a thumb that reports the scroll position, and a thumb the user can drag.

A scroll indicator that only reports is half a scrollbar. On a desktop, and on any platform driven by a mouse, the bar is also a control: grabbing the thumb and pulling it is how a long document is crossed, and a bar that cannot be grabbed sends the user back to the wheel for every long jump.

The thumb geometry is crate::scrollbar, shared with the curved indicator a round watch draws, so both answer “how long is the thumb and where does it sit” the same way. The drag is Modifier::draggable, so pulling a thumb obeys the same touch slop and axis locking as scrolling the content itself.

Structs§

ScrollbarColors
The colours a Scrollbar paints with.
ScrollbarSpec
How a Scrollbar is drawn and how short its thumb may get.

Constants§

DEFAULT_MIN_THUMB_EXTENT
How short the thumb may get, in logical pixels.
DEFAULT_SCROLLBAR_THICKNESS
How wide a bar is across its short axis.

Functions§

HorizontalScrollbar
A horizontal scrollbar for state.
Scrollbar
A scrollbar along axis, drawn and bounded by spec.
VerticalScrollbar
A vertical scrollbar for state, drawn down the space the modifier gives it.
draw_scrollbar
Draws a scrollbar into a scope whose bounds are the whole bar.