Class TouchPinchRotateEvent
- All Implemented Interfaces:
IInputEvent
,AutoCloseable
IInputEvent
representing a 2 pointers gesture.
This class aggregates information related to pinch and rotation in the same event.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static TouchPinchRotateEvent
createEvent
(Coordinate initialCenterLocation, double initialDistance, Angle initialAngle, Coordinate currentCenterLocation, double currentDistance, Angle currentAngle, Coordinate previousCenterLocation, double previousDistance, Angle previousAngle, EventStatus status) Creates a two pointer event.static TouchPinchRotateEvent
createStartEvent
(Coordinate initialCenterLocation, double initialDistance, Angle initialAngle, Coordinate currentCenterLocation, double currentDistance, Angle currentAngle) Creates the firstTouchPinchRotateEvent
of a gesture.protected void
finalize()
Returns the absolute angle between the two touch points.Returns the location of the current center between the 2 touch points.double
Returns the current distance between touch points.Returns the absolute angle between the two touch points at the beginning of the gesture.Returns the location of the center between the 2 starting touch point locations.double
Returns the span between the initial touch point positions.Returns the absolute angle between the two touch points from the previous event of this gesture.Returns the location of the center between the 2 touch points from the previous event of this gesture.Returns the distance between touch points from the previous event of this gesture.Returns the status of the event.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
createStartEvent
@NotNull public static TouchPinchRotateEvent createStartEvent(@NotNull Coordinate initialCenterLocation, double initialDistance, @NotNull Angle initialAngle, @NotNull Coordinate currentCenterLocation, double currentDistance, @NotNull Angle currentAngle) Creates the firstTouchPinchRotateEvent
of a gesture.The initial values refer to the situation at the beginning of the gesture (i.e. before any gesture detection). The current ones contain the values after the gesture detection is done.
- Parameters:
initialCenterLocation
- The center location at the beginning of the gesture, defined in device independent pixels.initialDistance
- The distance between the pointers at the beginning of the gesture, defined in device independent pixels.initialAngle
- The absolute angle between the two pointers at the beginning of the gesture.currentCenterLocation
- The current center location, defined in device independent pixels.currentDistance
- The current distance between the pointers, defined in device independent pixels.currentAngle
- The absolute angle between the two pointers. The status of the created event isEventStatus#Start
. The information relative to the previous event are std::nullopt.
-
createEvent
@NotNull public static TouchPinchRotateEvent createEvent(@NotNull Coordinate initialCenterLocation, double initialDistance, @NotNull Angle initialAngle, @NotNull Coordinate currentCenterLocation, double currentDistance, @NotNull Angle currentAngle, @NotNull Coordinate previousCenterLocation, double previousDistance, @NotNull Angle previousAngle, @NotNull EventStatus status) Creates a two pointer event.The initial values refer to the situation at the beginning of the gesture (i.e. before any gesture detection).
- Parameters:
initialCenterLocation
- The center location at the beginning of the gesture, defined in device independent pixels.initialDistance
- The distance between the pointers at the beginning of the gesture, defined in device independent pixels.initialAngle
- The absolute angle between the two pointers at the beginning of the gesture.currentCenterLocation
- The current center location, defined in device independent pixels.currentDistance
- The current distance between the pointers, defined in device independent pixels.currentAngle
- The absolute angle between the two pointers.previousCenterLocation
- The center location from the previous event of the gesture, defined in device independent pixels.previousDistance
- The distance between the pointers from the previous event of the gesture, defined in device independent pixels.previousAngle
- The absolute angle between the two pointers from the previous event of the gesture.status
- The status of the gesture.
-
getInitialCenterLocation
Returns the location of the center between the 2 starting touch point locations.It is expressed in device independent pixels.
- Returns:
- the location of the center between the 2 starting touch point locations.
-
getInitialDistance
public double getInitialDistance()Returns the span between the initial touch point positions.It is expressed in device independent pixels.
- Returns:
- the span between the initial touch point positions.
-
getInitialAngle
Returns the absolute angle between the two touch points at the beginning of the gesture.It is defined as the angle between the horizontal of the screen and the line connecting the two pointers. It is measured in degrees and counter-clockwise positive. An angle of 0 refers to the position where the first point is located to the left (west, left on the screen) of the other point.
- Returns:
- the absolute angle between the two touch points at the beginning of the gesture.
-
getCurrentCenterLocation
Returns the location of the current center between the 2 touch points.This location is defined in device independent pixels.
- Returns:
- the location of the current center between the 2 touch points.
-
getCurrentDistance
public double getCurrentDistance()Returns the current distance between touch points.This distance is defined in device independent pixels.
- Returns:
- the current distance between touch points.
-
getCurrentAngle
Returns the absolute angle between the two touch points.It is measured in degrees and counter-clockwise positive.
- Returns:
- the absolute angle between the two touch points.
-
getPreviousCenterLocation
Returns the location of the center between the 2 touch points from the previous event of this gesture.This location is defined in device independent pixels.
Returns
null
if this is the first event of the gesture (i.e. when thestatus
isEventStatus#Start
).- Returns:
- the location of the center between the 2 touch points from the previous event of this gesture.
-
getPreviousDistance
Returns the distance between touch points from the previous event of this gesture.This distance is defined in device independent pixels.
Returns
null
if this is the first event of the gesture (i.e. when thestatus
isEventStatus#Start
).- Returns:
- the distance between touch points from the previous event of this gesture.
-
getPreviousAngle
Returns the absolute angle between the two touch points from the previous event of this gesture.It is measured in degrees and counter-clockwise positive.
Returns
null
if this is the first event of the gesture (i.e. when thestatus
isEventStatus#Start
).- Returns:
- the absolute angle between the two touch points from the previous event of this gesture.
-
getStatus
Returns the status of the event.- Returns:
- the status of the event.
-