pub struct SCROLL;
Expand description
Controls the parent scroll.
Implementations§
source§impl SCROLL
impl SCROLL
sourcepub fn try_id(&self) -> Option<WidgetId>
pub fn try_id(&self) -> Option<WidgetId>
Gets the ID of the scroll ancestor represented by the SCROLL
.
sourcepub fn config_node(&self, child: impl UiNode) -> impl UiNode
pub fn config_node(&self, child: impl UiNode) -> impl UiNode
New node that holds data for the SCROLL
context.
Scroll implementers must add this node to their context.
sourcepub fn mode(&self) -> ReadOnlyVar<ScrollMode, ContextVar<ScrollMode>>
pub fn mode(&self) -> ReadOnlyVar<ScrollMode, ContextVar<ScrollMode>>
Scroll mode of the parent scroll.
sourcepub fn vertical_offset(&self) -> ContextVar<Factor>
pub fn vertical_offset(&self) -> ContextVar<Factor>
Vertical offset of the parent scroll.
The value is a percentage of content.height - viewport.height
.
This variable is usually read-write, but you should avoid modifying it directly as direct assign as the value is not validated and does not participate in smooths scrolling. Prefer the scroll methods of this service to scroll.
sourcepub fn horizontal_offset(&self) -> ContextVar<Factor>
pub fn horizontal_offset(&self) -> ContextVar<Factor>
Horizontal offset of the parent scroll.
The value is a percentage of content.width - viewport.width
.
This variable is usually read-write, but you should avoid modifying it directly as direct assign as the value is not validated and does not participate in smooths scrolling. Prefer the scroll methods of this service to scroll.
sourcepub fn zoom_scale(&self) -> ContextVar<Factor>
pub fn zoom_scale(&self) -> ContextVar<Factor>
Zoom scale factor of the parent scroll.
This variable is usually read-write, but you should avoid modifying it directly as direct assign as the value is not validated and does not participate in smooths scrolling. Prefer the zoom methods of this service to change scale.
sourcepub fn rendered_offset(&self) -> Factor2d
pub fn rendered_offset(&self) -> Factor2d
Latest rendered offset.
sourcepub fn rendered_zoom_scale(&self) -> Factor
pub fn rendered_zoom_scale(&self) -> Factor
Latest rendered zoom scale factor.
sourcepub fn vertical_overscroll(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
pub fn vertical_overscroll(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
Extra vertical offset, requested by touch gesture, that could not be fulfilled because vertical_offset
is already at 0.fct()
or 1.fct()
.
The factor is between in the -1.0..=1.0
range and represents the overscroll offset in pixels divided
by the viewport width.
sourcepub fn horizontal_overscroll(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
pub fn horizontal_overscroll(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
Extra horizontal offset requested that could not be fulfilled because horizontal_offset
is already at 0.fct()
or 1.fct()
.
The factor is between in the -1.0..=1.0
range and represents the overscroll offset in pixels divided
by the viewport width.
sourcepub fn vertical_ratio(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
pub fn vertical_ratio(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
Ratio of the scroll parent viewport height to its content.
The value is viewport.height / content.height
.
sourcepub fn horizontal_ratio(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
pub fn horizontal_ratio(&self) -> ReadOnlyVar<Factor, ContextVar<Factor>>
Ratio of the scroll parent viewport width to its content.
The value is viewport.width / content.width
.
sourcepub fn vertical_content_overflows(&self) -> ReadOnlyVar<bool, ContextVar<bool>>
pub fn vertical_content_overflows(&self) -> ReadOnlyVar<bool, ContextVar<bool>>
If the vertical scrollbar should be visible.
sourcepub fn horizontal_content_overflows(
&self,
) -> ReadOnlyVar<bool, ContextVar<bool>>
pub fn horizontal_content_overflows( &self, ) -> ReadOnlyVar<bool, ContextVar<bool>>
If the horizontal scrollbar should be visible.
sourcepub fn viewport_size(
&self,
) -> ReadOnlyVar<Size2D<Px, Px>, ContextVar<Size2D<Px, Px>>>
pub fn viewport_size( &self, ) -> ReadOnlyVar<Size2D<Px, Px>, ContextVar<Size2D<Px, Px>>>
Latest computed viewport size of the parent scroll.
sourcepub fn content_size(
&self,
) -> ReadOnlyVar<Size2D<Px, Px>, ContextVar<Size2D<Px, Px>>>
pub fn content_size( &self, ) -> ReadOnlyVar<Size2D<Px, Px>, ContextVar<Size2D<Px, Px>>>
Latest computed content size of the parent scroll.
sourcepub fn scroll_vertical(&self, delta: ScrollFrom)
pub fn scroll_vertical(&self, delta: ScrollFrom)
Applies the delta
to the vertical offset.
If smooth scrolling is enabled it is used to update the offset.
sourcepub fn scroll_horizontal(&self, delta: ScrollFrom)
pub fn scroll_horizontal(&self, delta: ScrollFrom)
Applies the delta
to the horizontal offset.
If smooth scrolling is enabled the chase animation is created or updated by this call.
sourcepub fn scroll_vertical_clamp(&self, delta: ScrollFrom, min: f32, max: f32)
pub fn scroll_vertical_clamp(&self, delta: ScrollFrom, min: f32, max: f32)
Applies the delta
to the vertical offset, but clamps the final offset by the inclusive min
and max
.
If smooth scrolling is enabled it is used to update the offset.
sourcepub fn scroll_horizontal_clamp(&self, delta: ScrollFrom, min: f32, max: f32)
pub fn scroll_horizontal_clamp(&self, delta: ScrollFrom, min: f32, max: f32)
Applies the delta
to the horizontal offset, but clamps the final offset by the inclusive min
and max
.
If smooth scrolling is enabled it is used to update the offset.
sourcepub fn auto_scroll(&self, velocity: Vector2D<Dip, Dip>)
pub fn auto_scroll(&self, velocity: Vector2D<Dip, Dip>)
Animate scroll at the direction and velocity (in DIPs per second).
sourcepub fn scroll_vertical_touch(&self, delta: Px)
pub fn scroll_vertical_touch(&self, delta: Px)
Applies the delta
to the vertical offset without smooth scrolling and
updates the vertical overscroll if it changes.
This method is used to implement touch gesture scrolling, the delta is always ScrollFrom::Var
.
sourcepub fn scroll_horizontal_touch(&self, delta: Px)
pub fn scroll_horizontal_touch(&self, delta: Px)
Applies the delta
to the horizontal offset without smooth scrolling and
updates the horizontal overscroll if it changes.
This method is used to implement touch gesture scrolling, the delta is always ScrollFrom::Var
.
sourcepub fn clear_vertical_overscroll(&self)
pub fn clear_vertical_overscroll(&self)
Quick ease vertical overscroll to zero.
sourcepub fn clear_horizontal_overscroll(&self)
pub fn clear_horizontal_overscroll(&self)
Quick ease horizontal overscroll to zero.
sourcepub fn scroll_vertical_touch_inertia(&self, delta: Px, duration: Duration)
pub fn scroll_vertical_touch_inertia(&self, delta: Px, duration: Duration)
Animates to delta
over duration
.
sourcepub fn scroll_horizontal_touch_inertia(&self, delta: Px, duration: Duration)
pub fn scroll_horizontal_touch_inertia(&self, delta: Px, duration: Duration)
Animates to delta
over duration
.
sourcepub fn chase_vertical(&self, modify_offset: impl FnOnce(Factor) -> Factor)
pub fn chase_vertical(&self, modify_offset: impl FnOnce(Factor) -> Factor)
Set the vertical offset to a new offset derived from the last, blending into the active smooth scrolling chase animation, or starting a new one, or just setting the var if smooth scrolling is disabled.
sourcepub fn chase_horizontal(&self, modify_offset: impl FnOnce(Factor) -> Factor)
pub fn chase_horizontal(&self, modify_offset: impl FnOnce(Factor) -> Factor)
Set the horizontal offset to a new offset derived from the last set offset, blending into the active smooth scrolling chase animation, or starting a new one, or just setting the var if smooth scrolling is disabled.
sourcepub fn chase_zoom(&self, modify_scale: impl FnOnce(Factor) -> Factor)
pub fn chase_zoom(&self, modify_scale: impl FnOnce(Factor) -> Factor)
Set the zoom scale to a new scale derived from the last set scale, blending into the active smooth scaling chase animation, or starting a new or, or just setting the var if smooth scrolling is disabled.
sourcepub fn zoom(
&self,
modify_scale: impl FnOnce(Factor) -> Factor,
origin: Point2D<Px, Px>,
)
pub fn zoom( &self, modify_scale: impl FnOnce(Factor) -> Factor, origin: Point2D<Px, Px>, )
Zoom in or out keeping the origin
point in the viewport aligned with the same point
in the content.
sourcepub fn zoom_touch(
&self,
phase: TouchPhase,
scale: Factor,
center_in_viewport: Point2D<f32, Px>,
)
pub fn zoom_touch( &self, phase: TouchPhase, scale: Factor, center_in_viewport: Point2D<f32, Px>, )
Applies the scale
to the current zoom scale without smooth scrolling and centered on the touch point.
sourcepub fn can_scroll_vertical(&self) -> impl Var<bool>
pub fn can_scroll_vertical(&self) -> impl Var<bool>
Gets a var that is true
when the content height is greater then the viewport height.
sourcepub fn can_scroll_horizontal(&self) -> impl Var<bool>
pub fn can_scroll_horizontal(&self) -> impl Var<bool>
Gets a var that is true
when the content width is greater then the viewport with.
sourcepub fn can_scroll_down(&self) -> impl Var<bool>
pub fn can_scroll_down(&self) -> impl Var<bool>
Gets a var that is true
when the content height is greater then the viewport height and the vertical offset
is not at the maximum.
sourcepub fn can_scroll_up(&self) -> impl Var<bool>
pub fn can_scroll_up(&self) -> impl Var<bool>
Gets a var that is true
when the content height is greater then the viewport height and the vertical offset
is not at the minimum.
sourcepub fn can_scroll_left(&self) -> impl Var<bool>
pub fn can_scroll_left(&self) -> impl Var<bool>
Gets a var that is true
when the content width is greater then the viewport width and the horizontal offset
is not at the minimum.
sourcepub fn can_scroll_right(&self) -> impl Var<bool>
pub fn can_scroll_right(&self) -> impl Var<bool>
Gets a var that is true
when the content width is greater then the viewport width and the horizontal offset
is not at the maximum.
sourcepub fn scroll_to(&self, mode: impl Into<ScrollToMode>)
pub fn scroll_to(&self, mode: impl Into<ScrollToMode>)
Scroll the WIDGET
into view.
sourcepub fn scroll_to_zoom(
&self,
mode: impl Into<ScrollToMode>,
zoom: impl Into<Factor>,
)
pub fn scroll_to_zoom( &self, mode: impl Into<ScrollToMode>, zoom: impl Into<Factor>, )
Scroll the WIDGET
into view and adjusts the zoom scale.
sourcepub fn can_zoom_in(&self) -> bool
pub fn can_zoom_in(&self) -> bool
Returns true
if the content can be scaled and the current scale is less than the max.
sourcepub fn can_zoom_out(&self) -> bool
pub fn can_zoom_out(&self) -> bool
Returns true
if the content can be scaled and the current scale is more than the min.
source§impl SCROLL
impl SCROLL
sourcepub fn context_values_set(&self, set: &mut ContextValueSet)
pub fn context_values_set(&self, set: &mut ContextValueSet)
Insert the context values used by SCROLL
in the set
.
Capturing this set plus all context vars enables using all SCROLL
methods outside the scroll.
Auto Trait Implementations§
impl Freeze for SCROLL
impl RefUnwindSafe for SCROLL
impl Send for SCROLL
impl Sync for SCROLL
impl Unpin for SCROLL
impl UnwindSafe for SCROLL
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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