MapTrip SDK Android Manual 9.9.7
IwScaleGestureDetector Class Reference

Classes

interface  OnScaleGestureListener
 

Public Member Functions

float getCurrentSpan ()
 
float getCurrentSpanX ()
 
float getCurrentSpanY ()
 
long getEventTime ()
 
float getFocusX ()
 
float getFocusY ()
 
float getPreviousSpan ()
 
float getPreviousSpanX ()
 
float getPreviousSpanY ()
 
float getScaleFactor ()
 
long getTimeDelta ()
 
boolean isInProgress ()
 
boolean isQuickScaleEnabled ()
 
boolean isStylusScaleEnabled ()
 
 IwScaleGestureDetector (Context context, OnScaleGestureListener listener)
 
 IwScaleGestureDetector (Context context, OnScaleGestureListener listener, Handler handler)
 
boolean onTouchEvent (MotionEvent event)
 
void setQuickScaleEnabled (boolean scales)
 
void setStylusScaleEnabled (boolean scales)
 
void setViewHeight (int viewHeight)
 

Detailed Description

The original ScaleGestureDetector has a very high minSpan value on high resolution tablets. This leads to an area whre the zoom does not work.

Additionally the quickScale does not work correctly anf generates scale factors < 0 which is fixed here

Reimplementation: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/ScaleGestureDetector.java

Constructor & Destructor Documentation

◆ IwScaleGestureDetector() [1/2]

IwScaleGestureDetector ( Context  context,
OnScaleGestureListener  listener 
)

Creates a ScaleGestureDetector with the supplied listener. You may only use this constructor from a Looper thread.

Parameters
contextthe application's context
listenerthe listener invoked for all the callbacks, this must not be null.
Exceptions
NullPointerExceptionif listener is null.

◆ IwScaleGestureDetector() [2/2]

IwScaleGestureDetector ( Context  context,
OnScaleGestureListener  listener,
Handler  handler 
)

Creates a ScaleGestureDetector with the supplied listener.

Parameters
contextthe application's context
listenerthe listener invoked for all the callbacks, this must not be null.
handlerthe handler to use for running deferred listener events.
Exceptions
NullPointerExceptionif listener is null.
See also
android.os.Handler::Handler()

Member Function Documentation

◆ getCurrentSpan()

float getCurrentSpan ( )

Return the average distance between each of the pointers forming the gesture in progress through the focal point.

Returns
Distance between pointers in pixels.

◆ getCurrentSpanX()

float getCurrentSpanX ( )

Return the average X distance between each of the pointers forming the gesture in progress through the focal point.

Returns
Distance between pointers in pixels.

◆ getCurrentSpanY()

float getCurrentSpanY ( )

Return the average Y distance between each of the pointers forming the gesture in progress through the focal point.

Returns
Distance between pointers in pixels.

◆ getEventTime()

long getEventTime ( )

Return the event time of the current event being processed.

Returns
Current event time in milliseconds.

◆ getFocusX()

float getFocusX ( )

Get the X coordinate of the current gesture's focal point. If a gesture is in progress, the focal point is between each of the pointers forming the gesture.

If isInProgress() would return false, the result of this function is undefined.

Returns
X coordinate of the focal point in pixels.

◆ getFocusY()

float getFocusY ( )

Get the Y coordinate of the current gesture's focal point. If a gesture is in progress, the focal point is between each of the pointers forming the gesture.

If isInProgress() would return false, the result of this function is undefined.

Returns
Y coordinate of the focal point in pixels.

◆ getPreviousSpan()

float getPreviousSpan ( )

Return the previous average distance between each of the pointers forming the gesture in progress through the focal point.

Returns
Previous distance between pointers in pixels.

◆ getPreviousSpanX()

float getPreviousSpanX ( )

Return the previous average X distance between each of the pointers forming the gesture in progress through the focal point.

Returns
Previous distance between pointers in pixels.

◆ getPreviousSpanY()

float getPreviousSpanY ( )

Return the previous average Y distance between each of the pointers forming the gesture in progress through the focal point.

Returns
Previous distance between pointers in pixels.

◆ getScaleFactor()

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()

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.

◆ isInProgress()

boolean isInProgress ( )

Returns true if a scale gesture is in progress.

◆ isQuickScaleEnabled()

boolean isQuickScaleEnabled ( )

Return whether the quick scale gesture, in which the user performs a double tap followed by a swipe, should perform scaling. {

See also
setQuickScaleEnabled(boolean)}.

◆ isStylusScaleEnabled()

boolean isStylusScaleEnabled ( )

Return whether the stylus scale gesture, in which the user uses a stylus and presses the button, should perform scaling. {

See also
setStylusScaleEnabled(boolean)}

◆ onTouchEvent()

boolean onTouchEvent ( MotionEvent  event)

Accepts MotionEvents and dispatches events to a OnScaleGestureListener when appropriate.

Applications should pass a complete and consistent event stream to this method. A complete and consistent event stream involves all MotionEvents from the initial ACTION_DOWN to the final ACTION_UP or ACTION_CANCEL.

Parameters
eventThe event to process
Returns
true if the event was processed and the detector wants to receive the rest of the MotionEvents in this event stream.

◆ setQuickScaleEnabled()

void setQuickScaleEnabled ( boolean  scales)

Set whether the associated OnScaleGestureListener should receive onScale callbacks when the user performs a doubleTap followed by a swipe. Note that this is enabled by default if the app targets API 19 and newer.

Parameters
scalestrue to enable quick scaling, false to disable

◆ setStylusScaleEnabled()

void setStylusScaleEnabled ( boolean  scales)

Sets whether the associates OnScaleGestureListener should receive onScale callbacks when the user uses a stylus and presses the button. Note that this is enabled by default if the app targets API 23 and newer.

Parameters
scalestrue to enable stylus scaling, false to disable.

◆ setViewHeight()

void setViewHeight ( int  viewHeight)

set the view height for calculating quickscale gestures

Parameters
viewHeight

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