public final class MotionShortcut extends Shortcut
MotionEvent shortcuts.
Motion shortcuts can be of one of two forms: 1. A gesture-id (e.g., 'LEFT_ID' , or even 'NO_ID') or, ; 2. A gesture-id + modifier key combinations (e.g., 'RIGHT_ID' + 'CTRL').
Note that the shortcut may be empty: the no-id (NO_ID) and no-modifier-mask (NO_MODIFIER_MASK) combo may also defined a shortcut. Empty shortcuts may bind gesture-less motion interactions (e.g., mouse move without any button pressed).
Note that the motion-event Shortcut.id() DOFs should be registered first (see
registerID(int, String)) before using the shortcut.
| Constructor and Description |
|---|
MotionShortcut()
Constructs an "empty" shortcut by conveniently calling
this(NO_MODIFIER_MASK, NO_ID); |
MotionShortcut(int id)
Defines a shortcut from the given gesture-id.
|
MotionShortcut(int m,
int id)
Defines a shortcut from the given modifier mask and gesture-id combination.
|
| Modifier and Type | Method and Description |
|---|---|
Class<? extends MotionEvent> |
defaultEventClass()
Returns the default-event class (alternative to
Shortcut.eventClass()) this shortcut is
to be attached to. |
static int |
dofs(int id)
Returns the
Shortcut.id() DOF's. |
Class<? extends MotionEvent> |
eventClass()
|
static boolean |
hasID(int id)
Same as
return Shortcut.hasID(MotionShortcut.class, id). |
static int |
registerID(int id,
int dof,
String description)
|
static int |
registerID(int dof,
String description)
|
description, equals, hashCode, hasID, id, modifiers, registerID, registerID, registerIDpublic MotionShortcut()
this(NO_MODIFIER_MASK, NO_ID);public MotionShortcut(int id)
id - gesture-idpublic MotionShortcut(int m,
int id)
m - the maskid - gesture-idpublic static int dofs(int id)
Shortcut.id() DOF's.
Returns null if nthe id is not registered.
public static int registerID(int id,
int dof,
String description)
id - the intended Shortcut.id() to be registered.dof - Motion id degrees-of-freedom. Either 1,2,3, or 6.registerID(int, String),
dofs(int),
hasID(int)public static int registerID(int dof,
String description)
dof - Motion id degrees-of-freedom. Either 1,2,3, or 6.registerID(int, int, String),
dofs(int),
hasID(int)public static boolean hasID(int id)
return Shortcut.hasID(MotionShortcut.class, id).public Class<? extends MotionEvent> eventClass()
DOFnEvent.class where n is dofs(int).
Returns MotionEvent.class if the shortcut Shortcut.id() isn't registered.
dofs(int),
registerID(int, int, String)public Class<? extends MotionEvent> defaultEventClass()
ShortcutShortcut.eventClass()) this shortcut is
to be attached to. Default value is null.
Override it when an optional Shortcut.eventClass() is needed (rarely). For an example
refer to the MotionEvent implementation.
Shortcut.eventClass()Processing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia