ZoomGestureDetector.OnZoomGestureListener


fun interface ZoomGestureDetector.OnZoomGestureListener


The listener for receiving notifications when gestures occur.

An application will receive events in the following order:

Summary

Public functions

Boolean

Responds to the events of a zooming gesture.

Public functions

onZoomEvent

Added in 1.4.0-alpha06
@UiThread
fun onZoomEvent(zoomEvent: ZoomGestureDetector.ZoomEvent): Boolean

Responds to the events of a zooming gesture.

Return true to indicate the event is handled by the listener.

  • For ZoomEvent.Begin events, the detector will ignore the rest of the gesture if it's not handled. For example, if a gesture is beginning with a focal point outside of a region where it makes sense, ZoomEvent.Begin event may return false to ignore the rest of the gesture.

  • For ZoomEvent.Move events, the detector will continue to accumulate movement if it's not handled. This can be useful if an application, for example, only wants to update scaling factors if the change is greater than 0.01.

  • For ZoomEvent.End events, the return value is ignored and the zoom gesture will end regardless of what is returned.

Once receiving ZoomEvent.End event, ZoomEvent.End.focusX and ZoomEvent.End.focusY will return focal point of the pointers remaining on the screen.

Parameters
zoomEvent: ZoomGestureDetector.ZoomEvent

The zoom event that contains extended info about event state.

Returns
Boolean

Whether or not the detector should consider this event as handled.