Struct conrod::scroll::Bar
[−]
[src]
pub struct Bar { pub interaction: Interaction, pub scrollable: Range, pub offset: Scalar, pub start_overlap: Scalar, }
The state of a single scrollbar.
Fields
interaction: Interaction
The current interaction with the Scrollbar.
scrollable: Range
The range to which the start of the visible range is bounded.
offset: Scalar
The distance from the start of the scrollable range and the start of the visible range. i.e. visible.start - scrollable.start
start_overlap: Scalar
If the start of the visible range would start before the range of the widget's kids' bounding box, this amount will represent the difference as a positive scalar value.
Otherwise, it will remain 0.0.
We need to keep track of this as we should never let the offset become before the start overlap when being scrolled.
Methods
impl Bar
[src]
fn new_if_scrollable(visible: Range, kids: Range, maybe_prev: Option<&Bar>) -> Option<Bar>
Construct a new Bar for a widget from a given visible range as well as the range occuppied by the widget's child widgets.
The given kids
Range should be relative to the visible range.
If there is some previous Bar its interaction will be carried through to the Bar.
fn handle_input(self, visible: Range, track: Rect, handle: Rect, mouse: &Mouse, mouse_pos_scalar: Scalar, mouse_scroll_scalar: Scalar) -> Bar
Update a scroll Bar
with the given mouse input.
fn kids_pos_offset(&self) -> Scalar
Converts the Bar's current offset to the positional offset required to shift the children widgets in accordance with the scrolling.
fn pos_offset_from_bar_offset(&self, bar_offset: Scalar, bar_len: Scalar) -> Scalar
Converts the given bar offset to a positional offset.
TODO: Needs testing.
Trait Implementations
impl PartialEq for Bar
[src]
fn eq(&self, __arg_0: &Bar) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Bar) -> bool
This method tests for !=
.
impl Debug for Bar
[src]
impl Clone for Bar
[src]
fn clone(&self) -> Bar
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more