protected final class

ZoomView.ZoomGestureHandler

extends GestureTracker.GestureHandler

 java.lang.Object

↳SimpleOnGestureListener

androidx.pdf.util.GestureTracker.GestureHandler

↳androidx.pdf.widget.ZoomView.ZoomGestureHandler

Overview

Gesture handler.

Summary

Fields
protected final floatmLinearScaleSpanMultiplier

The multiplier to convert from a scale gesture's delta span, in pixels, to scale factor.

Constructors
protectedZoomGestureHandler(Screen screen)

Methods
public booleanonDoubleTap(MotionEvent e)

public booleanonFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)

protected voidonGestureEnd(GestureTracker.Gesture gesture)

Called at the end of any gesture, after any other callback.

protected voidonGestureStart()

Called at the start of any gesture, before any other callback.

public booleanonScale(ScaleGestureDetector detector)

public voidonScaleEnd(ScaleGestureDetector detector)

public booleanonScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)

from GestureTracker.GestureHandleronScaleBegin
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

protected final float mLinearScaleSpanMultiplier

The multiplier to convert from a scale gesture's delta span, in pixels, to scale factor.

The Android framework returns scale factors proportional to the ratio of currentSpan / prevSpan. This is problematic because it results in scale factors that are very large for small pixel spans, which is particularly problematic for quickScale gestures, where the span pixel values can be small, but the ratio can yield very large scale factors.

Instead, we use this to ensure that pinching or quick scale dragging a certain number of pixels always corresponds to a certain change in zoom. The equation that we've found to work well is a delta span of the larger screen dimension should result in a zoom change of 2x.

Constructors

protected ZoomGestureHandler(Screen screen)

Methods

protected void onGestureStart()

Called at the start of any gesture, before any other callback.

public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)

public boolean onScale(ScaleGestureDetector detector)

public void onScaleEnd(ScaleGestureDetector detector)

protected void onGestureEnd(GestureTracker.Gesture gesture)

Called at the end of any gesture, after any other callback.

Parameters:

gesture: The detected gesture that just ended.

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)

public boolean onDoubleTap(MotionEvent e)