public class GestureEvent extends InputEvent
Delivery of gestures is dependent on the capabilities of the underlying platform and connected input devices. For instance on a PC with mouse and keyboard there is no way of producing a rotating gesture.
Modifier and Type | Field and Description |
---|---|
private boolean |
altDown |
static EventType<GestureEvent> |
ANY
Common supertype for all gestures.
|
private boolean |
controlDown |
private boolean |
direct |
private boolean |
inertia |
private boolean |
metaDown |
private PickResult |
pickResult
Information about the pick if the picked
Node is a
Shape3D node and its pickOnBounds is false. |
private double |
sceneX |
private double |
sceneY |
private double |
screenX |
private double |
screenY |
private static long |
serialVersionUID |
private boolean |
shiftDown |
private double |
x |
private double |
y |
private double |
z
Depth z position of the event relative to the
origin of the MouseEvent's node.
|
consumed, eventType, NULL_SOURCE_TARGET, target
Modifier | Constructor and Description |
---|---|
protected |
GestureEvent(EventType<? extends GestureEvent> eventType)
Deprecated.
Do not use this constructor. Constructs empty event.
|
protected |
GestureEvent(EventType<? extends GestureEvent> eventType,
double x,
double y,
double screenX,
double screenY,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean direct,
boolean inertia,
PickResult pickResult)
Constructs new GestureEvent event with empty source and target
|
protected |
GestureEvent(java.lang.Object source,
EventTarget target,
EventType<? extends GestureEvent> eventType)
Deprecated.
Do not use this constructor. Constructs empty event.
|
protected |
GestureEvent(java.lang.Object source,
EventTarget target,
EventType<? extends GestureEvent> eventType,
double x,
double y,
double screenX,
double screenY,
boolean shiftDown,
boolean controlDown,
boolean altDown,
boolean metaDown,
boolean direct,
boolean inertia,
PickResult pickResult)
Constructs new GestureEvent event.
|
Modifier and Type | Method and Description |
---|---|
GestureEvent |
copyFor(java.lang.Object newSource,
EventTarget newTarget)
Creates and returns a copy of this event with the specified event source
and target.
|
EventType<? extends GestureEvent> |
getEventType()
Gets the event type of this event.
|
PickResult |
getPickResult()
Returns information about the pick.
|
double |
getSceneX()
Gets the horizontal position of the event relative to the
origin of the
Scene that contains the event's source. |
double |
getSceneY()
Gets the vertical position of the event relative to the
origin of the
Scene that contains the event's source. |
double |
getScreenX()
Gets the absolute horizontal position of the event.
|
double |
getScreenY()
Gets the absolute vertical position of the event.
|
double |
getX()
Gets the horizontal position of the event relative to the
origin of the event's source.
|
double |
getY()
Gets the vertical position of the event relative to the
origin of the event's source.
|
double |
getZ()
Depth position of the event relative to the
origin of the MouseEvent's source.
|
boolean |
isAltDown()
Indicates whether or not the Alt modifier is down on this event.
|
boolean |
isControlDown()
Indicates whether or not the Control modifier is down on this event.
|
boolean |
isDirect()
Indicates whether this gesture is caused by a direct or indirect input
device.
|
boolean |
isInertia()
Indicates if this event represents an inertia of an already finished
gesture.
|
boolean |
isMetaDown()
Indicates whether or not the Meta modifier is down on this event.
|
boolean |
isShiftDown()
Indicates whether or not the Shift modifier is down on this event.
|
boolean |
isShortcutDown()
Indicates whether or not the host platform common shortcut modifier is
down on this event.
|
private void |
readObject(java.io.ObjectInputStream in) |
private void |
recomputeCoordinatesToSource(GestureEvent newEvent,
java.lang.Object newSource)
Fills the given event by this event's coordinates recomputed to the given
source object.
|
java.lang.String |
toString()
Returns a string representation of this
GestureEvent object. |
private static final long serialVersionUID
public static final EventType<GestureEvent> ANY
private transient double x
private transient double y
private transient double z
private final double screenX
private final double screenY
private final double sceneX
private final double sceneY
private final boolean shiftDown
private final boolean controlDown
private final boolean altDown
private final boolean metaDown
private final boolean direct
private final boolean inertia
private PickResult pickResult
Node
is a
Shape3D
node and its pickOnBounds is false.@Deprecated protected GestureEvent(EventType<? extends GestureEvent> eventType)
GestureEvent
.eventType
- Type of the event@Deprecated protected GestureEvent(java.lang.Object source, EventTarget target, EventType<? extends GestureEvent> eventType)
GestureEvent
.source
- Event sourcetarget
- Event targeteventType
- Type of the eventprotected GestureEvent(java.lang.Object source, EventTarget target, EventType<? extends GestureEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, 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 isDirect()
inertia
- if represents inertia of an already finished gesture.pickResult
- 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 targetprotected GestureEvent(EventType<? extends GestureEvent> eventType, double x, double y, double screenX, double screenY, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown, boolean direct, boolean inertia, 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 isDirect()
inertia
- if represents inertia of an already finished gesture.pickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinatesprivate void recomputeCoordinatesToSource(GestureEvent newEvent, java.lang.Object newSource)
newEvent
- Event whose coordinates are to be fillednewSource
- Source object to compute coordinates forpublic GestureEvent copyFor(java.lang.Object newSource, EventTarget newTarget)
Event
null
, it is
replaced by the NULL_SOURCE_TARGET
value.public final double getX()
isDirect()
public final double getY()
isDirect()
public final double getZ()
public final double getScreenX()
isDirect()
public final double getScreenY()
isDirect()
public final double getSceneX()
Scene
that contains the event's source.
If the node is not in a Scene
, then the value is relative to
the boundsInParent of the root-most parent of the event's node.
Note that in 3D scene, this represents the flat coordinates after
applying the projection transformations.Scene
that contains the event's sourceisDirect()
public final double getSceneY()
Scene
that contains the event's source.
If the node is not in a Scene
, then the value is relative to
the boundsInParent of the root-most parent of the event's node.
Note that in 3D scene, this represents the flat coordinates after
applying the projection transformations.Scene
that contains the event's sourceisDirect()
public final boolean isShiftDown()
public final boolean isControlDown()
public final boolean isAltDown()
public final boolean isMetaDown()
public final boolean isDirect()
public boolean isInertia()
public final PickResult getPickResult()
public final boolean isShortcutDown()
control
on Windows and meta
(command key) on Mac.true
if the shortcut modifier is down, false
otherwisepublic java.lang.String toString()
GestureEvent
object.toString
in class java.util.EventObject
GestureEvent
object.private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public EventType<? extends GestureEvent> getEventType()
Event
Event
class can have different event types. These event types further specify
what kind of event occurred.getEventType
in class InputEvent