oak.util
Class ScaleGestureDetector

java.lang.Object
  extended by oak.util.ScaleGestureDetector

public class ScaleGestureDetector
extends Object


Nested Class Summary
static interface ScaleGestureDetector.OnScaleGestureListener
           
static class ScaleGestureDetector.SimpleOnScaleGestureListener
          A convenience class to extend when you only want to listen for a subset of scaling-related events.
 
Constructor Summary
ScaleGestureDetector(android.content.Context context, ScaleGestureDetector.OnScaleGestureListener listener)
           
 
Method Summary
 float getCurrentSpan()
          Return the current distance between the two pointers forming the gesture in progress.
 long getEventTime()
          Return the event time of the current event being processed.
 float getFocusX()
          Get the X coordinate of the current gesture's focal point.
 float getFocusY()
          Get the Y coordinate of the current gesture's focal point.
 float getPreviousSpan()
          Return the previous distance between the two pointers forming the gesture in progress.
 float getScaleFactor()
          Return the scaling factor from the previous scale event to the current event.
 long getTimeDelta()
          Return the time difference in milliseconds between the previous accepted scaling event and the current scaling event.
 boolean isInProgress()
          Returns true if a two-finger scale gesture is in progress.
 boolean onTouchEvent(android.view.MotionEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScaleGestureDetector

public ScaleGestureDetector(android.content.Context context,
                            ScaleGestureDetector.OnScaleGestureListener listener)
Method Detail

onTouchEvent

public boolean onTouchEvent(android.view.MotionEvent event)

isInProgress

public boolean isInProgress()
Returns true if a two-finger scale gesture is in progress.

Returns:
true if a scale gesture is in progress, false otherwise.

getFocusX

public float getFocusX()
Get the X coordinate of the current gesture's focal point. If a gesture is in progress, the focal point is directly between the two pointers forming the gesture. If a gesture is ending, the focal point is the location of the remaining pointer on the screen. If isInProgress() would return false, the result of this function is undefined.

Returns:
X coordinate of the focal point in pixels.

getFocusY

public float getFocusY()
Get the Y coordinate of the current gesture's focal point. If a gesture is in progress, the focal point is directly between the two pointers forming the gesture. If a gesture is ending, the focal point is the location of the remaining pointer on the screen. If isInProgress() would return false, the result of this function is undefined.

Returns:
Y coordinate of the focal point in pixels.

getCurrentSpan

public float getCurrentSpan()
Return the current distance between the two pointers forming the gesture in progress.

Returns:
Distance between pointers in pixels.

getPreviousSpan

public float getPreviousSpan()
Return the previous distance between the two pointers forming the gesture in progress.

Returns:
Previous distance between pointers in pixels.

getScaleFactor

public float getScaleFactor()
Return the scaling factor from the previous scale event to the current event. This value is defined as (getCurrentSpan() / getPreviousSpan()).

Returns:
The current scaling factor.

getTimeDelta

public long getTimeDelta()
Return the time difference in milliseconds between the previous accepted scaling event and the current scaling event.

Returns:
Time difference since the last scaling event in milliseconds.

getEventTime

public long getEventTime()
Return the event time of the current event being processed.

Returns:
Current event time in milliseconds.


Copyright © 2011-2014. All Rights Reserved.