public final class TouchPoint extends Object implements Serializable
TouchEvent
.
The touch point has its coordinates, state (see TouchPoint.State
) and ID. The
ID is sequential number of this touch point unique in scope of a single
multi-touch gesture.
Each touch point is by default delivered to a single node during its whole
trajectory - to the node on which it was pressed. There is a grabbing API
to modify this behavior. The above means that when touch point is pressed,
it is automatically grabbed by the top-most node on the press coordinates.
Any time during the gesture grab()
and ungrab()
methods
can be used to alter the event delivery target. When grabbed by a different
node, it will next time be targeted to it; when ungrabbed, it will be
always targeted to the top-most node on the current location.
Modifier and Type | Class and Description |
---|---|
static class |
TouchPoint.State
Represents current state of the touch point
|
Constructor and Description |
---|
TouchPoint(int id,
TouchPoint.State state,
double x,
double y,
double screenX,
double screenY,
EventTarget target,
PickResult pickResult)
Creates new instance of TouchPoint.
|
Modifier and Type | Method and Description |
---|---|
boolean |
belongsTo(EventTarget target)
Distinguishes between touch points targeted to the given node or some
of its children from touch points targeted somewhere else.
|
EventTarget |
getGrabbed()
Gets event target which has grabbed this touch point.
|
int |
getId()
Gets identifier of this touch point.
|
PickResult |
getPickResult()
Returns information about the pick.
|
double |
getSceneX()
Gets the horizontal position of the touch point relative to the
origin of the
Scene that contains the TouchEvent's source. |
double |
getSceneY()
Gets the vertical position of the touch point relative to the
origin of the
Scene that contains the TouchEvent's source. |
double |
getScreenX()
Gets the absolute horizontal position of the touch point.
|
double |
getScreenY()
Gets the absolute vertical position of the touch point.
|
TouchPoint.State |
getState()
Gets state of this touch point
|
EventTarget |
getTarget()
Gets event target on which the touch event carrying this touch point
is fired.
|
double |
getX()
Gets the horizontal position of the touch point relative to the
origin of the TouchEvent's source.
|
double |
getY()
Gets the vertical position of the touch point relative to the
origin of the TouchEvent's source.
|
double |
getZ()
Depth position of the event relative to the
origin of the MouseEvent's source.
|
void |
grab()
Grabs this touch point by current event source.
|
void |
grab(EventTarget target)
Grabs this touch point by the given target.
|
String |
toString()
Returns a string representation of this
TouchPoint object. |
void |
ungrab()
Ungrabs this touch point from its target.
|
public TouchPoint(int id, TouchPoint.State state, double x, double y, double screenX, double screenY, EventTarget target, PickResult pickResult)
id
- ID of the new touch pointstate
- state of the new touch pointx
- 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.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 targetpublic boolean belongsTo(EventTarget target)
target
- Node or other event target to be testedpublic EventTarget getGrabbed()
public void grab()
public void grab(EventTarget target)
target
- Target by which to grab the touch pointpublic void ungrab()
public final int getId()
1
, each subsequently pressed touch points gets the next ordinal
number until all touch points are released and the counter is reset.public final TouchPoint.State getState()
public final double getX()
public final double getY()
public final double getZ()
public final double getScreenX()
public final double getScreenY()
public final double getSceneX()
Scene
that contains the TouchEvent'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 TouchEvent's node.
Note that in 3D scene, this represents the flat coordinates after
applying the projection transformations.Scene
that contains the TouchEvent's sourcepublic final double getSceneY()
Scene
that contains the TouchEvent'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 TouchEvent's node.
Note that in 3D scene, this represents the flat coordinates after
applying the projection transformations.Scene
that contains the TouchEvent's sourcepublic final PickResult getPickResult()
public EventTarget getTarget()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.