JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.newt.event.DoubleTapScrollGesture Class Reference

2 pointer scroll/rotate gesture handler processing MouseEvents while producing MouseEvent#EVENT_MOUSE_WHEEL_MOVED events if gesture is completed. More...

Inheritance diagram for com.jogamp.newt.event.DoubleTapScrollGesture:
Collaboration diagram for com.jogamp.newt.event.DoubleTapScrollGesture:

Public Member Functions

 DoubleTapScrollGesture (final int scaledScrollSlop, final int scaledDoubleTapSlop)
 scaledScrollSlop < scaledDoubleTapSlop More...
 
String toString ()
 
void clear (final boolean clearStarted)
 Clears state of handler, i.e. More...
 
boolean isWithinGesture ()
 Returns true if within a gesture as detected by a previous process(InputEvent) command, which has not been cleared. More...
 
boolean hasGesture ()
 Returns true if a previous process(InputEvent) command produced a gesture, which has not been cleared. More...
 
InputEvent getGestureEvent ()
 Returns the corresponding InputEvent for the gesture as detected by a previous process(InputEvent), which has not been cleared. More...
 
final float[] getScrollDistanceXY ()
 
boolean process (final InputEvent in)
 Process the given InputEvent and returns true if it produced the gesture. More...
 
void clear (boolean clearStarted)
 Clears state of handler, i.e. More...
 
boolean hasGesture ()
 Returns true if a previous process(InputEvent) command produced a gesture, which has not been cleared. More...
 
InputEvent getGestureEvent ()
 Returns the corresponding InputEvent for the gesture as detected by a previous process(InputEvent), which has not been cleared. More...
 
boolean isWithinGesture ()
 Returns true if within a gesture as detected by a previous process(InputEvent) command, which has not been cleared. More...
 
boolean process (InputEvent e)
 Process the given InputEvent and returns true if it produced the gesture. More...
 

Static Public Attributes

static final int SCROLL_SLOP_PIXEL
 Scroll threshold in pixels (fallback), defaults to 16 pixels. More...
 
static final int DOUBLE_TAP_SLOP_PIXEL
 Two pointer 'double tap' slop in pixels (fallback), defaults to 104 pixels. More...
 
static final float SCROLL_SLOP_MM
 Scroll threshold in millimeter, defaults to 3 mm. More...
 
static final float DOUBLE_TAP_SLOP_MM
 Two pointer 'double tap' slop in millimeter, defaults to 20 mm. More...
 
- Static Public Attributes inherited from com.jogamp.newt.event.GestureHandler
static final boolean DEBUG = Debug.debug("Window.MouseEvent")
 

Detailed Description

2 pointer scroll/rotate gesture handler processing MouseEvents while producing MouseEvent#EVENT_MOUSE_WHEEL_MOVED events if gesture is completed.

Criteria related to parameters:

  • doubleTapSlop (scaled in pixels):

    • Max 2 finger distance to start 'scroll' mode
    • Max. distance diff of current 2-pointer middle and initiated 2-pointer middle. - touchSlop (scaled in pixels):
    • Min. movement w/ 2 pointer within ScaledDoubleTapSlop starting 'scroll' mode - Avoid computation if not within gesture, especially for MOVE/DRAG - Only allow gesture to start with PRESS - Leave gesture completely with RELEASE of both/all fingers, or dist-diff exceeds doubleTapSlop - Tolerate temporary lift 1 of 2 pointer - Always validate pointer-id

    Implementation uses a n-state to get detect gesture:

    from to action
    NONE 1PRESS 1-pointer-pressed
    1PRESS 2PRESS_T 2-pointer-pressed within doubleTapSlope
    2PRESS_T SCROLL 2-pointer dragged, dist-diff within doubleTapSlop and scrollLen >= scrollSlop
    2PRESS_C SCROLL 2-pointer dragged, dist-diff within doubleTapSlop
    SCROLL SCROLL 2-pointer dragged, dist-diff within doubleTapSlop

    State ST_2PRESS_C merely exist to pick up gesture after one pointer has been lost temporarily.

    isWithinGesture() returns gestureState >= 2PRESS_C

Definition at line 74 of file DoubleTapScrollGesture.java.

Constructor & Destructor Documentation

◆ DoubleTapScrollGesture()

com.jogamp.newt.event.DoubleTapScrollGesture.DoubleTapScrollGesture ( final int  scaledScrollSlop,
final int  scaledDoubleTapSlop 
)

scaledScrollSlop < scaledDoubleTapSlop

Parameters
scaledScrollSlopDistance a pointer can wander before we think the user is scrolling in pixels.
scaledDoubleTapSlopDistance in pixels between the first touch and second touch to still be considered a double tap.

Definition at line 134 of file DoubleTapScrollGesture.java.

Here is the call graph for this function:

Member Function Documentation

◆ clear()

void com.jogamp.newt.event.DoubleTapScrollGesture.clear ( final boolean  clearStarted)

Clears state of handler, i.e.

resets all states incl. previous detected gesture.

Parameters
clearStartedif true, also clears started state, otherwise stay within gesture - if appropriate. Staying within a gesture allows fluent continuous gesture sequence, e.g. for scrolling.

Implements com.jogamp.newt.event.GestureHandler.

Definition at line 153 of file DoubleTapScrollGesture.java.

Here is the caller graph for this function:

◆ getGestureEvent()

InputEvent com.jogamp.newt.event.DoubleTapScrollGesture.getGestureEvent ( )

Returns the corresponding InputEvent for the gesture as detected by a previous process(InputEvent), which has not been cleared.

Otherwise returns null.

Only implemented for gestures mapping to InputEvents.

Implements com.jogamp.newt.event.GestureHandler.

Definition at line 178 of file DoubleTapScrollGesture.java.

Here is the call graph for this function:

◆ getScrollDistanceXY()

final float[] com.jogamp.newt.event.DoubleTapScrollGesture.getScrollDistanceXY ( )

Definition at line 197 of file DoubleTapScrollGesture.java.

◆ hasGesture()

boolean com.jogamp.newt.event.DoubleTapScrollGesture.hasGesture ( )

Returns true if a previous process(InputEvent) command produced a gesture, which has not been cleared.

Otherwise returns false.

Implements com.jogamp.newt.event.GestureHandler.

Definition at line 173 of file DoubleTapScrollGesture.java.

◆ isWithinGesture()

boolean com.jogamp.newt.event.DoubleTapScrollGesture.isWithinGesture ( )

Returns true if within a gesture as detected by a previous process(InputEvent) command, which has not been cleared.

Otherwise returns false.

Implements com.jogamp.newt.event.GestureHandler.

Definition at line 168 of file DoubleTapScrollGesture.java.

Here is the caller graph for this function:

◆ process()

boolean com.jogamp.newt.event.DoubleTapScrollGesture.process ( final InputEvent  e)

Process the given InputEvent and returns true if it produced the gesture.

Otherwise returns false.

If a gesture was already detected previously and has not been cleared, method does not process the event and returns true.

Besides validation of the event's details, the handler may also validate the InputEvent.InputClass and/or InputEvent.InputType.

Implements com.jogamp.newt.event.GestureHandler.

Definition at line 202 of file DoubleTapScrollGesture.java.

Here is the call graph for this function:

◆ toString()

String com.jogamp.newt.event.DoubleTapScrollGesture.toString ( )

Definition at line 148 of file DoubleTapScrollGesture.java.

Here is the call graph for this function:

Member Data Documentation

◆ DOUBLE_TAP_SLOP_MM

final float com.jogamp.newt.event.DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM
static

Two pointer 'double tap' slop in millimeter, defaults to 20 mm.

Can be overriden by integer property newt.event.double_tap_slop_mm.

Definition at line 83 of file DoubleTapScrollGesture.java.

◆ DOUBLE_TAP_SLOP_PIXEL

final int com.jogamp.newt.event.DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL
static

Two pointer 'double tap' slop in pixels (fallback), defaults to 104 pixels.

Can be overriden by integer property newt.event.double_tap_slop_pixel.

Definition at line 78 of file DoubleTapScrollGesture.java.

◆ SCROLL_SLOP_MM

final float com.jogamp.newt.event.DoubleTapScrollGesture.SCROLL_SLOP_MM
static

Scroll threshold in millimeter, defaults to 3 mm.

Can be overriden by integer property newt.event.scroll_slop_mm.

Definition at line 81 of file DoubleTapScrollGesture.java.

◆ SCROLL_SLOP_PIXEL

final int com.jogamp.newt.event.DoubleTapScrollGesture.SCROLL_SLOP_PIXEL
static

Scroll threshold in pixels (fallback), defaults to 16 pixels.

Can be overriden by integer property newt.event.scroll_slop_pixel.

Definition at line 76 of file DoubleTapScrollGesture.java.


The documentation for this class was generated from the following file: