list: let the swipe reveal stretch to three cell widths
This commit is contained in:
@@ -165,15 +165,15 @@ class SwipeActionsCallback(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Map a raw drag to its visual translation: one-to-one up to [reveal], then increasing
|
* Map a raw drag to its visual translation: one-to-one up to [reveal], then increasing
|
||||||
* resistance asymptotic to twice the reveal, so the row can be pulled past the cell but
|
* resistance asymptotic to three times the reveal, so the row can be pulled well past the
|
||||||
* fights back more the further it goes.
|
* cell but fights back more the further it goes.
|
||||||
*/
|
*/
|
||||||
private fun rubberBand(dX: Float, reveal: Float): Float {
|
private fun rubberBand(dX: Float, reveal: Float): Float {
|
||||||
val past = abs(dX) - reveal
|
val past = abs(dX) - reveal
|
||||||
if (past <= 0f) {
|
if (past <= 0f) {
|
||||||
return dX
|
return dX
|
||||||
}
|
}
|
||||||
return sign(dX) * (reveal + past / (1f + past / reveal))
|
return sign(dX) * (reveal + past / (1f + past / (2f * reveal)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The square underlay cell's width: a standard large touchable size. */
|
/** The square underlay cell's width: a standard large touchable size. */
|
||||||
|
|||||||
Reference in New Issue
Block a user