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
◆ IwScaleGestureDetector() [1/2]
Creates a ScaleGestureDetector with the supplied listener. You may only use this constructor from a Looper thread.
- Parameters
-
| context | the application's context |
| listener | the listener invoked for all the callbacks, this must not be null. |
- Exceptions
-
| NullPointerException | if listener is null. |
◆ IwScaleGestureDetector() [2/2]
Creates a ScaleGestureDetector with the supplied listener.
- Parameters
-
| context | the application's context |
| listener | the listener invoked for all the callbacks, this must not be null. |
| handler | the handler to use for running deferred listener events. |
- Exceptions
-
| NullPointerException | if listener is null. |
- See also
- android.os.Handler::Handler()
◆ 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()
Return the event time of the current event being processed.
- Returns
- Current event time in milliseconds.
◆ 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()
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()
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()
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()
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
-
| event | The 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
-
| scales | true 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
-
| scales | true to enable stylus scaling, false to disable. |
◆ setViewHeight()
| void setViewHeight |
( |
int |
viewHeight | ) |
|
set the view height for calculating quickscale gestures
- Parameters
-
The documentation for this class was generated from the following file: