Struct nannou::ui::prelude::widget::scroll::State [−][src]
pub struct State<A> { pub offset: f64, pub offset_bounds: Range, pub scrollable_range_len: f64, pub is_scrolling: bool, // some fields omitted }
Scroll state calculated for a single axis.
Fields
offset: f64
The distance that has been scrolled from the origin.
A positive offset pushes the scrollable range that is under the kid_area upwards.
A negative offset pushes the scrollable range that is under the kid_area downwards.
offset_bounds: Range
The start and end bounds for the offset along the axis.
scrollable_range_len: f64
The total range which may be “offset” from the “root” range (aka the kid_area
).
The scrollable_range
is determined as the bounding range around both the kid_area
and
all un-scrolled visible children widgets.
is_scrolling: bool
Whether or not the this axis is currently scrolling.
Implementations
impl<A> State<A> where
A: Axis,
[src]
A: Axis,
pub fn update(
ui: &Ui,
idx: NodeIndex<u32>,
kid_area: &KidArea,
maybe_prev_scroll_state: Option<State<A>>,
additional_offset: f64
) -> State<A>
[src]
ui: &Ui,
idx: NodeIndex<u32>,
kid_area: &KidArea,
maybe_prev_scroll_state: Option<State<A>>,
additional_offset: f64
) -> State<A>
Calculate the new scroll state for the single axis of a Widget
.
> +---+
| | |
| =========================
| | | a | scroll root |
| | +---+ aka `kid_area` |
| | +--------+ |
| | | | |
| =========================
| | b |
| +--------+
scrollable| +--------+
range y| | |
| | | +------+
| | c | | |
| +--------+ | d |
| | |
> +------+
^--------------------^
scrollable
range x
kid_area
is the cropped area of the container widget in which kid widgets may be viewed.a
,b
,c
andd
are widgets that are kids of the “scroll root” widget in their original, un-scrolled positions.scrollable_range
is the total range occuppied by all children widgets in their original, un-scrolled positions.
Everything above and below the set of ==== bars of the parent widget is hidden, i.e:
=========================
| | a | scroll root |
| +---+ aka `kid_area` |
| +--------+ |
| | b | |
=========================
The scrollable_range
on each axis only becomes scrollable if its length exceeds the
length of the kid_area
on the same axis. Thus, in the above example, only the y
scrollable_range is scrollable.
The offset_bounds
are calculated as the amount which the original, un-scrolled,
scrollable_range
may be offset from its origin.
offset + >
bounds v |
.start > | =========================
| | |
| | kid_area |
| | |
| | |
> scrollable | =========================
^ range y |
^ |
^ |
offset ^ |
bounds ^ |
.end ^ |
^ |
^ |
+ >
Trait Implementations
impl<A> Clone for State<A> where
A: Clone,
[src]
A: Clone,
impl<A> Copy for State<A> where
A: Copy,
[src]
A: Copy,
impl<A> Debug for State<A> where
A: Debug,
[src]
A: Debug,
impl<A> PartialEq<State<A>> for State<A> where
A: PartialEq<A>,
[src]
A: PartialEq<A>,
impl<A> StructuralPartialEq for State<A>
[src]
Auto Trait Implementations
impl<A> RefUnwindSafe for State<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
impl<A> Send for State<A> where
A: Send,
A: Send,
impl<A> Sync for State<A> where
A: Sync,
A: Sync,
impl<A> Unpin for State<A> where
A: Unpin,
A: Unpin,
impl<A> UnwindSafe for State<A> where
A: UnwindSafe,
A: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
[src]
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
pub fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
pub fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
pub fn convert_into(self) -> U
[src]
pub fn convert_unclamped_into(self) -> U
[src]
pub fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> Downcast<T> for T
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> SetParameter for T
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Upcast<T> for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,