diff --git a/skiko/src/androidMain/kotlin/org/jetbrains/skiko/Convertors.android.kt b/skiko/src/androidMain/kotlin/org/jetbrains/skiko/Convertors.android.kt index 910cbf77e5..262c57203d 100644 --- a/skiko/src/androidMain/kotlin/org/jetbrains/skiko/Convertors.android.kt +++ b/skiko/src/androidMain/kotlin/org/jetbrains/skiko/Convertors.android.kt @@ -99,13 +99,13 @@ private val swipeThreshold = 100 private val swipeVelocityThreshold = 100 internal fun toSkikoGestureDirection( - event1: MotionEvent, + event1: MotionEvent?, event2: MotionEvent, velocityX: Float, velocityY: Float ): SkikoGestureEventDirection { - val dx = event2.x - event1.x - val dy = event2.y - event1.y + val dx = event2.x - (event1?.x ?: 0f) + val dy = event2.y - (event1?.y ?: 0f) if (abs(dx) > abs(dy)) { if (abs(dx) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold) { if (dx > 0) { diff --git a/skiko/src/androidMain/kotlin/org/jetbrains/skiko/SkikoGesturesDetector.android.kt b/skiko/src/androidMain/kotlin/org/jetbrains/skiko/SkikoGesturesDetector.android.kt index 190644a3fa..206287d061 100644 --- a/skiko/src/androidMain/kotlin/org/jetbrains/skiko/SkikoGesturesDetector.android.kt +++ b/skiko/src/androidMain/kotlin/org/jetbrains/skiko/SkikoGesturesDetector.android.kt @@ -79,7 +79,7 @@ internal class SkikoGesturesDetector( } override fun onScroll( - event1: MotionEvent, + event1: MotionEvent?, event2: MotionEvent, distanceX: Float, distanceY: Float, @@ -98,7 +98,7 @@ internal class SkikoGesturesDetector( } override fun onFling( - event1: MotionEvent, + event1: MotionEvent?, event2: MotionEvent, velocityX: Float, velocityY: Float