com.maryanovsky.gwtutils.client.ui.touch.gestures.pinch
Class PinchRecognizer

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
      extended by com.maryanovsky.gwtutils.client.ui.touch.gestures.pinch.PinchRecognizer
All Implemented Interfaces:
HasAllPinchHandlers, HasPinchCancelHandlers, HasPinchChangeHandlers, HasPinchEndHandlers, HasPinchStartHandlers

public class PinchRecognizer
extends TouchGestureRecognizer
implements HasAllPinchHandlers

Recognizes and fires pinch events.

Author:
Maryanovsky Alexander

Field Summary
 
Fields inherited from class com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
handlerManager
 
Constructor Summary
PinchRecognizer(Object eventSource)
          Creates a new PinchRecognizer which will fire pinch events with the specified source object.
PinchRecognizer(Object pinchEventsSource, Condition<? super PinchStartEvent> pinchCondition)
          Creates a new PinchRecognizer which will fire pinch events with the specified source object and consult the specified pinch condition before doing so.
PinchRecognizer(Object eventSource, H touchEventsSource)
          Creates a new PinchRecognizer which will fire pinch events with the specified source object and use the specified source of touch events.
PinchRecognizer(Object dragEventsSource, H touchEventsSource, Condition<? super PinchStartEvent> pinchCondition)
          Creates a new PinchRecognizer which will fire events with the specified source object, use the specified source of touch events and consult the specified pinch condition before firing the pinch event(s).
 
Method Summary
 HandlerRegistration addPinchCancelHandler(PinchCancelHandler handler)
          Adds a pinch cancel handler.
 HandlerRegistration addPinchChangeHandler(PinchChangeHandler handler)
          Adds a pinch change handler.
 HandlerRegistration addPinchEndHandler(PinchEndHandler handler)
          Adds a pinch end handler.
 HandlerRegistration addPinchStartHandler(PinchStartHandler handler)
          Adds a pinch start handler.
protected  void onTouchCancel(TouchCancelEvent evt)
          Invoked when a touch event is canceled.
protected  void onTouchEnd(TouchEndEvent evt)
          Invoked when a finger touching the screen is lifted.
protected  void onTouchMove(TouchMoveEvent evt)
          Invoked when a finger touching the screen is moved.
protected  void onTouchStart(TouchStartEvent evt)
          Invoked when a touch starts.
protected  boolean pinchCondition(PinchStartEvent evt)
          Returns whether the specified PinchStartEvent and the pinch events that follow it in the pinch gesture should be delivered to the handlers.
 
Methods inherited from class com.maryanovsky.gwtutils.client.ui.touch.gestures.TouchGestureRecognizer
fireEvent, setTouchEventsSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PinchRecognizer

public PinchRecognizer(Object eventSource)
Creates a new PinchRecognizer which will fire pinch events with the specified source object.


PinchRecognizer

public PinchRecognizer(Object eventSource,
                       H touchEventsSource)
Creates a new PinchRecognizer which will fire pinch events with the specified source object and use the specified source of touch events.


PinchRecognizer

public PinchRecognizer(Object pinchEventsSource,
                       Condition<? super PinchStartEvent> pinchCondition)
Creates a new PinchRecognizer which will fire pinch events with the specified source object and consult the specified pinch condition before doing so.


PinchRecognizer

public PinchRecognizer(Object dragEventsSource,
                       H touchEventsSource,
                       Condition<? super PinchStartEvent> pinchCondition)
Creates a new PinchRecognizer which will fire events with the specified source object, use the specified source of touch events and consult the specified pinch condition before firing the pinch event(s). See the documentation of pinchCondition(PinchStartEvent) for more information on the pinch condition.

Method Detail

addPinchStartHandler

public HandlerRegistration addPinchStartHandler(PinchStartHandler handler)
Adds a pinch start handler.

Specified by:
addPinchStartHandler in interface HasPinchStartHandlers

addPinchChangeHandler

public HandlerRegistration addPinchChangeHandler(PinchChangeHandler handler)
Adds a pinch change handler.

Specified by:
addPinchChangeHandler in interface HasPinchChangeHandlers

addPinchEndHandler

public HandlerRegistration addPinchEndHandler(PinchEndHandler handler)
Adds a pinch end handler.

Specified by:
addPinchEndHandler in interface HasPinchEndHandlers

addPinchCancelHandler

public HandlerRegistration addPinchCancelHandler(PinchCancelHandler handler)
Adds a pinch cancel handler.

Specified by:
addPinchCancelHandler in interface HasPinchCancelHandlers

pinchCondition

protected boolean pinchCondition(PinchStartEvent evt)
Returns whether the specified PinchStartEvent and the pinch events that follow it in the pinch gesture should be delivered to the handlers. This allows filtering pinch gestures to only those you really want. The default implementation delegates the decision to the pinch condition passed in the constructor.


onTouchStart

protected void onTouchStart(TouchStartEvent evt)
Invoked when a touch starts.

Overrides:
onTouchStart in class TouchGestureRecognizer

onTouchMove

protected void onTouchMove(TouchMoveEvent evt)
Invoked when a finger touching the screen is moved.

Overrides:
onTouchMove in class TouchGestureRecognizer

onTouchEnd

protected void onTouchEnd(TouchEndEvent evt)
Invoked when a finger touching the screen is lifted.

Overrides:
onTouchEnd in class TouchGestureRecognizer

onTouchCancel

protected void onTouchCancel(TouchCancelEvent evt)
Invoked when a touch event is canceled.

Overrides:
onTouchCancel in class TouchGestureRecognizer