mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
Fix parent scroll with pinch-to-zoom on image
commit_hash:be85e8988df8e571f1cfce999ff864d46f655ce2
This commit is contained in:
+10
-6
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user