Fix parent scroll with pinch-to-zoom on image

commit_hash:be85e8988df8e571f1cfce999ff864d46f655ce2
This commit is contained in:
grechka62
2026-03-31 14:47:52 +03:00
parent 26e5ae49f2
commit 35869bdf90
@@ -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()