Skip to content

Instantly share code, notes, and snippets.

@mr5z
Created August 11, 2020 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr5z/fe099973693ee47702f5f49d9acbba21 to your computer and use it in GitHub Desktop.
Save mr5z/fe099973693ee47702f5f49d9acbba21 to your computer and use it in GitHub Desktop.
var hasMoved: Boolean = false
get() {
if (initialTouchPosition == null)
return false
if (lastTouchPosition == null)
return false
val xDiff = abs(initialTouchPosition!!.x - lastTouchPosition!!.x)
val yDiff = abs(initialTouchPosition!!.y - lastTouchPosition!!.y)
val epsilon = 0.1
return xDiff > epsilon || yDiff > epsilon
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment