public class MotionEvent extends BogusEvent
BogusEvent
s defined from
DOFs (degrees-of-freedom).
A MotionEvent encapsulates a MotionShortcut
. MotionEvents
may be relative or absolute (see isRelative()
, isAbsolute()
)
depending whether or not they're constructed from a previous MotionEvent. While
relative motion events have distance()
, speed()
, and
delay()
, absolute motion events don't.
ALT, ALT_GRAPH, CTRL, META, NO_ID, NO_MODIFIER_MASK, SHIFT
Constructor and Description |
---|
MotionEvent()
Constructs an absolute MotionEvent with an "empty"
MotionShortcut . |
MotionEvent(int modifiers)
Constructs an absolute MotionEvent taking the given
modifiers as a
MotionShortcut . |
MotionEvent(int modifiers,
int id)
|
Modifier and Type | Method and Description |
---|---|
long |
delay()
Returns the delay between two consecutive motion events.
|
float |
distance()
Returns the distance between two consecutive motion events.
|
static DOF1Event |
dof1Event(MotionEvent event)
Same as
return dof1Event(event, true) . |
static DOF1Event |
dof1Event(MotionEvent event,
boolean fromX)
Returns a
DOF1Event from the MotionEvent x-coordinate if
fromX is true and from the y-coordinate otherwise. |
static DOF2Event |
dof2Event(MotionEvent event)
Same as
return dof2Event(event, true) . |
static DOF2Event |
dof2Event(MotionEvent event,
boolean fromX)
Returns a
DOF2Event from the MotionEvent x-coordinate if
fromX is true and from the y-coordinate otherwise. |
static DOF3Event |
dof3Event(MotionEvent event)
Same as
return dof3Event(event, true) . |
static DOF3Event |
dof3Event(MotionEvent event,
boolean fromTranslation)
Returns a
DOF3Event from the MotionEvent
translation-coordinates if fromTranslation is true and from the
rotation-coordinate otherwise. |
static DOF6Event |
dof6Event(MotionEvent event)
|
boolean |
equals(Object obj) |
MotionEvent |
fire()
Same as
this.get() but sets the BogusEvent.fired() flag to true. |
MotionEvent |
flush()
Same as
this.get() but sets the BogusEvent.flushed() flag to true. |
MotionEvent |
get()
Returns a deep copy of the object.
|
int |
hashCode() |
boolean |
isAbsolute()
Returns true if the motion event is absolute, i.e., it hasn't been built from a
previous motion event.
|
boolean |
isRelative()
Returns true if the motion event is relative, i.e., it has been built from a previous
motion event.
|
void |
modulate(float[] sens)
Modulate the event dofs according to
sens . |
MotionShortcut |
shortcut() |
float |
speed()
Returns the speed between two consecutive motion events.
|
fired, flushed, id, isAltDown, isAltGraph, isControlDown, isMetaDown, isNull, isShiftDown, modifiers, modifiersText, timestamp
public MotionEvent()
MotionShortcut
.public MotionEvent(int modifiers)
modifiers
as a
MotionShortcut
.public MotionEvent(int modifiers, int id)
public int hashCode()
hashCode
in class BogusEvent
public boolean equals(Object obj)
equals
in class BogusEvent
public MotionEvent get()
Copyable
Typical implementation should simple look like: return new Object(this)
.
get
in interface Copyable
get
in class BogusEvent
public MotionEvent flush()
BogusEvent
this.get()
but sets the BogusEvent.flushed()
flag to true. Only agents
may call this.flush
in class BogusEvent
BogusEvent.flushed()
public MotionEvent fire()
BogusEvent
this.get()
but sets the BogusEvent.fired()
flag to true. Only agents
may call this.fire
in class BogusEvent
BogusEvent.flushed()
public void modulate(float[] sens)
sens
. Only meaningful if the event
isAbsolute()
.public MotionShortcut shortcut()
shortcut
in class BogusEvent
Shortcut
public long delay()
isRelative()
.public float distance()
isRelative()
.public float speed()
isRelative()
.public boolean isRelative()
public boolean isAbsolute()
public static DOF1Event dof1Event(MotionEvent event)
return dof1Event(event, true)
.dof1Event(MotionEvent, boolean)
public static DOF1Event dof1Event(MotionEvent event, boolean fromX)
DOF1Event
from the MotionEvent x-coordinate if
fromX
is true
and from the y-coordinate otherwise.public static DOF2Event dof2Event(MotionEvent event)
return dof2Event(event, true)
.dof2Event(MotionEvent, boolean)
public static DOF2Event dof2Event(MotionEvent event, boolean fromX)
DOF2Event
from the MotionEvent x-coordinate if
fromX
is true
and from the y-coordinate otherwise.public static DOF3Event dof3Event(MotionEvent event)
return dof3Event(event, true)
.dof3Event(MotionEvent, boolean)
public static DOF3Event dof3Event(MotionEvent event, boolean fromTranslation)
DOF3Event
from the MotionEvent
translation-coordinates if fromTranslation
is true
and from the
rotation-coordinate otherwise.public static DOF6Event dof6Event(MotionEvent event)
Processing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia