diff --git a/client/android/div-pinch-to-zoom/src/main/java/com/yandex/div/zoom/ZoomTouchListener.kt b/client/android/div-pinch-to-zoom/src/main/java/com/yandex/div/zoom/ZoomTouchListener.kt index 08228f3c2..e0b83506c 100644 --- a/client/android/div-pinch-to-zoom/src/main/java/com/yandex/div/zoom/ZoomTouchListener.kt +++ b/client/android/div-pinch-to-zoom/src/main/java/com/yandex/div/zoom/ZoomTouchListener.kt @@ -63,13 +63,21 @@ internal class ZoomTouchListener( return true } - MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { + MotionEvent.ACTION_UP -> { if (touchController.isInZoom) { touchController.finishZoomTouch(view, event) return true } return view.tryDispatchGesture(event) } + + MotionEvent.ACTION_CANCEL -> { + if (touchController.isInZoom) { + touchController.finishZoomTouch(view, event) + return true + } + return view.handleTouchEvent(event) + } } return false @@ -126,11 +134,7 @@ internal class ZoomTouchListener( private fun View.dispatchEvent(downTime: Long, eventTime: Long, action: Int, x: Float, y: Float) { val event = MotionEvent.obtain(downTime, eventTime, action, x, y, 0) dispatchTouchEvent(event) - try { - event.recycle() - } catch (_: IllegalStateException) { - // ignore - } + event.recycle() } private fun offset(index: Int) = (viewLocation[index] - rootLocation[index]).toFloat()