fix: Swipy (#506)

This commit is contained in:
Dawn-used-yeet 2024-10-29 13:04:34 +05:30 committed by GitHub
parent 652ef219dd
commit f191502a97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -159,8 +159,7 @@ class Swipy @JvmOverloads constructor(
}
private fun handleDrag(pos: Float) {
val overscroll = (pos - initialMotion) * DRAG_RATE
if (overscroll > 0) { // Keep this check
val overscroll = abs((pos - initialMotion) * DRAG_RATE)
parent.requestDisallowInterceptTouchEvent(true)
if (vertical) {
val totalDragDistance = Resources.getSystem().displayMetrics.heightPixels / dragDivider
@ -176,14 +175,13 @@ class Swipy @JvmOverloads constructor(
rightBeingSwiped.invoke(overscroll / totalDragDistance)
}
}
}
private fun resetSwipes() {
if (vertical) {
topBeingSwiped.invoke(0f)
bottomBeingSwiped.invoke(0f)
} else {
rightBeingSwiped.invoke( 0f)
rightBeingSwiped.invoke(0f)
leftBeingSwiped.invoke(0f)
}
}