java.lang.Object
javafx.scene.input.TouchPoint
- All Implemented Interfaces:
- Serializable
Touch point represents a single point of a multi-touch action, typically
 one finger touching a screen. It is contained in 
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.
- Since:
- JavaFX 2.2
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumRepresents current state of the touch point
- 
Constructor SummaryConstructorsConstructorDescriptionTouchPoint(int id, TouchPoint.State state, double x, double y, double screenX, double screenY, EventTarget target, PickResult pickResult) Creates new instance of TouchPoint.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbelongsTo(EventTarget target) Distinguishes between touch points targeted to the given node or some of its children from touch points targeted somewhere else.Gets event target which has grabbed this touch point.final intgetId()Gets identifier of this touch point.final PickResultReturns information about the pick.final doubleGets the horizontal position of the touch point relative to the origin of theScenethat contains the TouchEvent's source.final doubleGets the vertical position of the touch point relative to the origin of theScenethat contains the TouchEvent's source.final doubleGets the absolute horizontal position of the touch point.final doubleGets the absolute vertical position of the touch point.final TouchPoint.StategetState()Gets state of this touch pointGets event target on which the touch event carrying this touch point is fired.final doublegetX()Gets the horizontal position of the touch point relative to the origin of the TouchEvent's source.final doublegetY()Gets the vertical position of the touch point relative to the origin of the TouchEvent's source.final doublegetZ()Depth position of the event relative to the origin of the MouseEvent's source.voidgrab()Grabs this touch point by current event source.voidgrab(EventTarget target) Grabs this touch point by the given target.toString()Returns a string representation of thisTouchPointobject.voidungrab()Ungrabs this touch point from its target.
- 
Constructor Details- 
TouchPointpublic TouchPoint(int id, TouchPoint.State state, double x, double y, double screenX, double screenY, EventTarget target, PickResult pickResult) Creates new instance of TouchPoint.- Parameters:
- id- ID of the new touch point
- state- state of the new touch point
- 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.
- target- Node or other event target.
- 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 target
- Since:
- JavaFX 8.0
 
 
- 
- 
Method Details- 
belongsToDistinguishes between touch points targeted to the given node or some of its children from touch points targeted somewhere else. This allows for testing all touch points carried by one touch event on their relevance for a given node.- Parameters:
- target- Node or other event target to be tested
- Returns:
- true if this touch point is targeted to the given target or some of its children
 
- 
getGrabbedGets event target which has grabbed this touch point.- Returns:
- The current grabbed target, null if the touch point is ungrabbed
 
- 
grabpublic void grab()Grabs this touch point by current event source. Next event containing this touch point will be targeted to the same node whose event handler called this method.
- 
grabGrabs this touch point by the given target. Next event containing this touch point will be targeted to it.- Parameters:
- target- Target by which to grab the touch point
 
- 
ungrabpublic void ungrab()Ungrabs this touch point from its target. Since the next event this touch point will be delivered to the top-most node picked on its respective location until it is grabbed again or released.
- 
getIdpublic final int getId()Gets identifier of this touch point. The number is sequential and unique in scope of one multi touch gesture. The first pressed touch point has id1, each subsequently pressed touch points gets the next ordinal number until all touch points are released and the counter is reset.- Returns:
- the identifier of this touch point.
 
- 
getStateGets state of this touch point- Returns:
- state of this touch point
 
- 
getXpublic final double getX()Gets the horizontal position of the touch point relative to the origin of the TouchEvent's source.- Returns:
- the horizontal position of the touch point relative to the origin of the TouchEvent's source.
 
- 
getYpublic final double getY()Gets the vertical position of the touch point relative to the origin of the TouchEvent's source.- Returns:
- the vertical position of the touch point relative to the origin of the TouchEvent's source.
 
- 
getZpublic final double getZ()Depth position of the event relative to the origin of the MouseEvent's source.- Returns:
- depth position of the event relative to the origin of the MouseEvent's source.
- Since:
- JavaFX 8.0
 
- 
getScreenXpublic final double getScreenX()Gets the absolute horizontal position of the touch point.- Returns:
- the absolute horizontal position of the touch point
 
- 
getScreenYpublic final double getScreenY()Gets the absolute vertical position of the touch point.- Returns:
- the absolute vertical position of the touch point
 
- 
getSceneXpublic final double getSceneX()Gets the horizontal position of the touch point relative to the origin of theScenethat contains the TouchEvent's source. If the node is not in aScene, 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.- Returns:
- the horizontal position of the touch point relative to the
 origin of the Scenethat contains the TouchEvent's source
 
- 
getSceneYpublic final double getSceneY()Gets the vertical position of the touch point relative to the origin of theScenethat contains the TouchEvent's source. If the node is not in aScene, 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.- Returns:
- the vertical position of the touch point relative to the
 origin of the Scenethat contains the TouchEvent's source
 
- 
getPickResultReturns information about the pick.- Returns:
- new PickResult object that contains information about the pick
- Since:
- JavaFX 8.0
 
- 
getTargetGets event target on which the touch event carrying this touch point is fired.- Returns:
- Event target for this touch point
 
- 
toStringReturns a string representation of thisTouchPointobject.
 
-