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: f32How 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: f32How far to scroll (in pixels) in a container that scrolls horizontally.
uptime_millis: u64Time 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
impl RotaryScrollEvent
Sourcepub const fn new(
vertical_scroll_pixels: f32,
horizontal_scroll_pixels: f32,
uptime_millis: u64,
) -> RotaryScrollEvent
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.
Sourcepub fn from_detents(
detents: f32,
vertical_scroll_factor: f32,
horizontal_scroll_factor: f32,
uptime_millis: u64,
) -> RotaryScrollEvent
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.
Trait Implementations§
Source§impl Clone for RotaryScrollEvent
impl Clone for RotaryScrollEvent
Source§fn clone(&self) -> RotaryScrollEvent
fn clone(&self) -> RotaryScrollEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more