Skip to main content

RotaryScrollEvent

Struct RotaryScrollEvent 

Source
pub struct RotaryScrollEvent {
    pub vertical_scroll_pixels: f32,
    pub horizontal_scroll_pixels: f32,
    pub uptime_millis: u64,
}
Expand description

A rotary scroll event produced by a Wear OS crown or rotating bezel.

Field-for-field equivalent to Compose’s androidx.compose.ui.input.rotary.RotaryScrollEvent. The scroll amounts are in pixels, not detents: the platform layer has already multiplied the raw axis value by the system scroll factor.

This type is Copy and contains no heap data, so dispatching one allocates nothing.

Fields§

§vertical_scroll_pixels: f32

How far to scroll (in pixels) in a container that scrolls vertically.

Negative when the user turned the crown “up”/away (positive AXIS_SCROLL on Android); see the module docs for the derivation.

§horizontal_scroll_pixels: f32

How far to scroll (in pixels) in a container that scrolls horizontally.

§uptime_millis: u64

Time in milliseconds at which the event occurred. The zero point is platform-dependent (Android’s uptime clock, the process start elsewhere), so only differences between events are meaningful.

Implementations§

Source§

impl RotaryScrollEvent

Source

pub const fn new( vertical_scroll_pixels: f32, horizontal_scroll_pixels: f32, uptime_millis: u64, ) -> RotaryScrollEvent

Creates a rotary event from scroll amounts that are already in pixels.

Source

pub fn from_detents( detents: f32, vertical_scroll_factor: f32, horizontal_scroll_factor: f32, uptime_millis: u64, ) -> RotaryScrollEvent

Builds a rotary event from a raw Android AXIS_SCROLL value in detents.

detents is the value straight out of AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_SCROLL, 0); the scroll factors are ViewConfiguration.getScaledVerticalScrollFactor() and getScaledHorizontalScrollFactor().

The detent value is negated exactly once, matching Compose (see the module docs), and the same negated value feeds both axes.

Source

pub fn is_empty(&self) -> bool

Returns true when neither axis carries a usable scroll amount.

Non-finite values (NaN/inf from a misbehaving driver) count as empty so they are dropped at the ingress instead of poisoning scroll offsets.

Trait Implementations§

Source§

impl Clone for RotaryScrollEvent

Source§

fn clone(&self) -> RotaryScrollEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RotaryScrollEvent

Source§

impl Debug for RotaryScrollEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for RotaryScrollEvent

Source§

fn default() -> RotaryScrollEvent

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RotaryScrollEvent

Source§

fn eq(&self, other: &RotaryScrollEvent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RotaryScrollEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.