Package tripleplay.util
Class Tapper
java.lang.Object
react.Slot<Object>
playn.scene.Pointer.Listener
tripleplay.util.Tapper
- All Implemented Interfaces:
react.Reactor.RListener
,react.SignalView.Listener<Object>
,react.ValueView.Listener<Object>
- Direct Known Subclasses:
DoubleTapper
Detects taps on a layer. This is a simple implementation using a threshold distance. If the
pointer is dragged less than the threshold, a call to
onTap(Event.XY)
is generated.-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
Default threshold distance.static final float
Default threshold distance, set toDEFAULT_TAP_DIST
squared.float
Square of the threshold distance for this tapper, defaults toDEFAULT_TAP_DIST_SQ
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onCancel
(Pointer.Interaction iact) void
onDrag
(Pointer.Interaction iact) void
onEnd
(Pointer.Interaction iact) void
onStart
(Pointer.Interaction iact) void
onTap()
Called when a tap occurs.void
Called when a tap occurs.Methods inherited from class playn.scene.Pointer.Listener
onEmit
Methods inherited from class react.Slot
andThen, compose, filtered, onChange
-
Field Details
-
DEFAULT_TAP_DIST
public static final float DEFAULT_TAP_DISTDefault threshold distance.- See Also:
-
DEFAULT_TAP_DIST_SQ
public static final float DEFAULT_TAP_DIST_SQDefault threshold distance, set toDEFAULT_TAP_DIST
squared.- See Also:
-
maxTapDistSq
public float maxTapDistSqSquare of the threshold distance for this tapper, defaults toDEFAULT_TAP_DIST_SQ
.
-
-
Constructor Details
-
Tapper
public Tapper()
-
-
Method Details
-
onTap
public void onTap()Called when a tap occurs. This is a simpler version ofonTap(Event.XY)
, for subclasses that don't require the event position. -
onTap
Called when a tap occurs. By default, this just callsonTap()
. Subclasses overriding needn't call super.- Parameters:
where
- the pointer's end position
-
onStart
- Overrides:
onStart
in classPointer.Listener
-
onEnd
- Overrides:
onEnd
in classPointer.Listener
-
onDrag
- Overrides:
onDrag
in classPointer.Listener
-
onCancel
- Overrides:
onCancel
in classPointer.Listener
-