public final class SwipeEvent extends GestureEvent
Unlike some other gestures, the swipe gesture is not continual - the whole gesture produces only one event. The event is delivered to the top-most node picked on the gesture coordinates.
The swipe gesture has four types according to the movement direction.
The gesture can be performed by any number of touch points, the number
is provided by getTouchCount()
method.
Note that swipe and scroll gestures are not exclusive. A single touch screen action can result in both gestures being delivered.
Note that the capability to produce swipes is dependent on the used input devices and underlying platform's capabilities and settings (especially without touch-screen user's possibilities of producing swipes are significantly reduced).
As all gestures, swipe can be direct (performed directly at the concrete coordinates as on touch screen - the center of the gesture is used as gesture coordinates) or indirect (performed indirectly as on track pad - the mouse cursor location is usually used as the gesture coordinates in this case).
Modifier and Type | Field and Description |
---|---|
static <any> |
ANY
Common supertype for all swipe event types.
|
private static long |
serialVersionUID |
static <any> |
SWIPE_DOWN
This event occurs when user performs downward swipe gesture.
|
static <any> |
SWIPE_LEFT
This event occurs when user performs leftward swipe gesture.
|
static <any> |
SWIPE_RIGHT
This event occurs when user performs rightward swipe gesture.
|
static <any> |
SWIPE_UP
This event occurs when user performs upward swipe gesture.
|
private int |
touchCount |
Constructor and Description |
---|
SwipeEvent(<any> eventType,
double x,
double y,
double screenX,
double screenY,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean direct,
int touchCount,
PickResult pickResult)
Constructs new SwipeEvent event with null source and target.
|
SwipeEvent(java.lang.Object source,
EventTarget target,
<any> eventType,
double x,
double y,
double screenX,
double screenY,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean direct,
int touchCount,
PickResult pickResult)
Constructs new SwipeEvent event.
|
Modifier and Type | Method and Description |
---|---|
SwipeEvent |
copyFor(java.lang.Object newSource,
EventTarget newTarget) |
SwipeEvent |
copyFor(java.lang.Object newSource,
EventTarget newTarget,
<any> type)
Creates a copy of the given event with the given fields substituted.
|
<any> |
getEventType() |
int |
getTouchCount()
Gets number of touch points that caused this event.
|
java.lang.String |
toString()
Returns a string representation of this
SwipeEvent object. |
getPickResult, getSceneX, getSceneY, getScreenX, getScreenY, getX, getY, getZ, isAltDown, isControlDown, isDirect, isInertia, isMetaDown, isShiftDown, isShortcutDown
private static final long serialVersionUID
public static final <any> ANY
public static final <any> SWIPE_LEFT
public static final <any> SWIPE_RIGHT
public static final <any> SWIPE_UP
public static final <any> SWIPE_DOWN
private final int touchCount
public SwipeEvent(java.lang.Object source, EventTarget target, <any> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, int touchCount, PickResult pickResult)
source
- the source of the event. Can be null.target
- the target of the event. Can be null.eventType
- The type of the event.x
- The x with respect to the scene.y
- The y with respect to the scene.screenX
- The x coordinate relative to screen.screenY
- The y coordinate relative to screen.shiftDown
- true if shift modifier was pressed.controlDown
- true if control modifier was pressed.altDown
- true if alt modifier was pressed.metaDown
- true if meta modifier was pressed.direct
- true if the event was caused by direct input device. See GestureEvent.isDirect()
touchCount
- number of touch pointspickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinates and the targetpublic SwipeEvent(<any> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, int touchCount, PickResult pickResult)
eventType
- The type of the event.x
- The x with respect to the scene.y
- The y with respect to the scene.screenX
- The x coordinate relative to screen.screenY
- The y coordinate relative to screen.shiftDown
- true if shift modifier was pressed.controlDown
- true if control modifier was pressed.altDown
- true if alt modifier was pressed.metaDown
- true if meta modifier was pressed.direct
- true if the event was caused by direct input device. See GestureEvent.isDirect()
touchCount
- number of touch pointspickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinatespublic int getTouchCount()
public java.lang.String toString()
SwipeEvent
object.toString
in class GestureEvent
SwipeEvent
object.public SwipeEvent copyFor(java.lang.Object newSource, EventTarget newTarget)
GestureEvent
copyFor
in class GestureEvent
public SwipeEvent copyFor(java.lang.Object newSource, EventTarget newTarget, <any> type)
newSource
- the new source of the copied eventnewTarget
- the new target of the copied eventtype
- the new eventTypepublic <any> getEventType()
getEventType
in class GestureEvent