Skip to content

Commit

Permalink
Fix SimpleOnGestureListener implementation in SkikoGesturesDetector.a…
Browse files Browse the repository at this point in the history
…ndroid.kt
  • Loading branch information
m-sasha committed Jun 19, 2023
1 parent 8a83c49 commit 19c4114
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal class SkikoGesturesDetector(
}

override fun onScroll(
event1: MotionEvent,
event1: MotionEvent?,
event2: MotionEvent,
distanceX: Float,
distanceY: Float,
Expand All @@ -98,7 +98,7 @@ internal class SkikoGesturesDetector(
}

override fun onFling(
event1: MotionEvent,
event1: MotionEvent?,
event2: MotionEvent,
velocityX: Float,
velocityY: Float
Expand Down

0 comments on commit 19c4114

Please sign in to comment.