Struct android_activity::input::MotionEvent
source · #[repr(transparent)]pub struct MotionEvent<'a> { /* private fields */ }
Expand description
A motion event
For general discussion of motion events in Android, see the relevant javadoc.
Implementations§
source§impl<'a> MotionEvent<'a>
impl<'a> MotionEvent<'a>
sourcepub fn action(&self) -> MotionAction
pub fn action(&self) -> MotionAction
Returns the motion action associated with the event.
sourcepub fn pointer_index(&self) -> usize
pub fn pointer_index(&self) -> usize
Returns the pointer index of an Up
or Down
event.
Pointer indices can change per motion event. For an identifier that stays the same, see
Pointer::pointer_id()
.
This only has a meaning when the action is one of Up
,
Down
, PointerUp
,
or PointerDown
.
sourcepub fn pointer_count(&self) -> usize
pub fn pointer_count(&self) -> usize
Returns the number of pointers in this event
sourcepub fn pointers(&self) -> PointersIter<'_> ⓘ
pub fn pointers(&self) -> PointersIter<'_> ⓘ
An iterator over the pointers in this motion event
sourcepub fn pointer_at_index(&self, index: usize) -> Pointer<'_>
pub fn pointer_at_index(&self, index: usize) -> Pointer<'_>
The pointer at a given pointer index. Panics if the pointer index is out of bounds.
If you need to loop over all the pointers, prefer the pointers()
method.
sourcepub fn meta_state(&self) -> MetaState
pub fn meta_state(&self) -> MetaState
Returns the state of any modifier keys that were pressed during the event.
See the NDK docs
Returns the button state during this event, as a bitfield.
See the NDK docs
sourcepub fn down_time(&self) -> i64
pub fn down_time(&self) -> i64
Returns the time of the start of this gesture, in the java.lang.System.nanoTime()
time
base
See the NDK docs
sourcepub fn edge_flags(&self) -> EdgeFlags
pub fn edge_flags(&self) -> EdgeFlags
Returns a bitfield indicating which edges were touched by this event.
See the NDK docs
sourcepub fn event_time(&self) -> i64
pub fn event_time(&self) -> i64
Returns the time of this event, in the java.lang.System.nanoTime()
time base
See the NDK docs
sourcepub fn flags(&self) -> MotionEventFlags
pub fn flags(&self) -> MotionEventFlags
The flags associated with a motion event.
See the NDK docs
sourcepub fn x_precision(&self) -> f32
pub fn x_precision(&self) -> f32
Returns the precision of the x value of the coordinates
See the NDK docs
sourcepub fn y_precision(&self) -> f32
pub fn y_precision(&self) -> f32
Returns the precision of the y value of the coordinates
See the NDK docs