diff --git a/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt b/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt index 20ea3b76b2..28e8589382 100644 --- a/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +++ b/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt @@ -57,6 +57,11 @@ class PinchGestureHandler : GestureHandler() { scaleGestureDetector = ScaleGestureDetector(context, gestureListener) val configuration = ViewConfiguration.get(context) spanSlop = configuration.scaledTouchSlop.toFloat() + + // set the focal point to the position of the first pointer as NaN causes the event not to arrive + this.focalPointX = event.x + this.focalPointY = event.y + begin() } scaleGestureDetector?.onTouchEvent(sourceEvent) diff --git a/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt b/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt index 99c4d44233..d3d12f4601 100644 --- a/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +++ b/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt @@ -45,6 +45,11 @@ class RotationGestureHandler : GestureHandler() { if (state == STATE_UNDETERMINED) { resetProgress() rotationGestureDetector = RotationGestureDetector(gestureListener) + + // set the anchor to the position of the first pointer as NaN causes the event not to arrive + this.anchorX = event.x + this.anchorY = event.y + begin() } rotationGestureDetector?.onTouchEvent(sourceEvent)